Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. import java.io.File;
  2.  
  3.  
  4. import javax.swing.JOptionPane;
  5. import java.lang.Runtime.*;
  6. import java.net.*;
  7. import java.io.IOException;
  8. import java.net.URL;
  9. import javax.sound.sampled.AudioFormat;
  10. import javax.sound.sampled.AudioInputStream;
  11. import javax.sound.sampled.AudioSystem;
  12. import javax.sound.sampled.Clip;
  13. import javax.sound.sampled.DataLine;
  14. import javax.sound.sampled.LineUnavailableException;
  15. import javax.sound.sampled.UnsupportedAudioFileException;
  16.  
  17. import java.io.*;
  18.  
  19. public class regulate {
  20.  
  21. public static void main(String[] args) {
  22.  
  23. System.out.println("Oppresors will be brought down low");
  24.  
  25. playAudio();
  26.  
  27. Runtime runtime = Runtime.getRuntime();
  28.  
  29. runtime.gc();
  30.  
  31. long memory = runtime.freeMemory();
  32.  
  33. int buffer = (int)memory;
  34.  
  35. String output = Integer.toString(buffer);
  36.  
  37. JOptionPane.showMessageDialog(null, "Checking Memory of RAM", output, JOptionPane.INFORMATION_MESSAGE);
  38.  
  39. }
  40.  
  41. static void playAudio(){
  42.  
  43. try {
  44.  
  45. URL url = new URL("http://www.castemcompany.com/regulator.mp3");
  46.  
  47. AudioInputStream stream = AudioSystem.getAudioInputStream(url);
  48. Clip clip = AudioSystem.getClip();
  49. clip.open(stream);
  50. clip.start();
  51.  
  52. } catch(Exception ex) {
  53.  
  54. System.out.println("Error with playing sound.");
  55. ex.printStackTrace();
  56.  
  57. }
  58. }
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement