Here you can find the source of getFileSize(String filename)
public static int getFileSize(String filename)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static int getFileSize(String filename) { try {/*from w ww.j av a 2 s .c om*/ File fl = new File(filename); int length = (int) fl.length(); return length; } catch (Exception e) { return 0; } } }