Here you can find the source of getFileLength(String path)
public static Long getFileLength(String path)
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; public class Main { public static Long getFileLength(String path) { Long fileLength = null;//from w ww .jav a 2 s. c om try { FileInputStream in = new FileInputStream(path); File file = new File(path); fileLength = file.length(); } catch (FileNotFoundException e) { e.printStackTrace(); } return fileLength; } }