Get size in java we can in bytes, KB, MB etc. you can find using this code:


File myFile=new File("c:\\myFile.txt");
System.out.println("bytes : " + myFile.length());
System.out.println("Kbytes : " + myFile.length() / 1024);
System.out.println("Mbytes : " + (myFile.length() / 1024) / 1024);
\\ etc