Here you can find the source of getFileSize(String fileName, Logger log)
public static long getFileSize(String fileName, Logger log)
//package com.java2s; import java.io.File; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static long getFileSize(String fileName, Logger log) { File file = new File(fileName); //// ww w. j av a2s . c om // File is supposed to be on disk already, since the file was used for // the first time // if (!file.exists()) { if (log != null) log.log(Level.WARNING, "File \"" + fileName + "\" not found, so size is zero"); return 0; } return file.length(); } }