Advertisement
Guest User

Untitled

a guest
Sep 16th, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. import java.io.File;
  2.  
  3. public class main {
  4.  
  5.     public static void main(String[] args) {
  6.        
  7.         System.out.println("Verfügbarer Speicherplatz:\n");
  8.         System.out.println(getDriveStorage() + " bytes");
  9.         System.out.println(getDriveStorage()/1024 + " Kbytes");
  10.         System.out.println(getDriveStorage()/1024/1024 + " Mbytes");
  11.         System.out.println(getDriveStorage()/1024/1024/1024 + " Gbytes");
  12.     }
  13.    
  14.     private static long getDriveStorage() {
  15.        
  16.         String laufwerk = "C:/";       
  17.         File f = new File(laufwerk);       
  18.         return f.getFreeSpace();
  19.        
  20.     }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement