Here you can find the source of getFileSizes(File f)
public static long getFileSizes(File f) throws IOException
//package com.java2s; //License from project: LGPL import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class Main { public static long getFileSizes(File f) throws IOException { long s = 0; if (f.exists()) { FileInputStream fis = null; fis = new FileInputStream(f); s = fis.available();/*w w w. j a va2 s . com*/ } return s; } }