Java File get file length/size
import java.io.File; public class Main { public static void main(String[] args) { File myFile = new File("Main.java"); long fileLength = myFile.length(); System.out.println(fileLength); }//from ww w .ja v a2s . c om }