import org.apache.commons.io.FileUtils;
import java.io.File;
public class Main {
public static void main(String[] args) {
File file = new File("c:\\java.exe");
long size = file.length();
String display = FileUtils.byteCountToDisplaySize(size);
System.out.println("Name = " + file.getName());
System.out.println("size = " + size);
System.out.println("Display = " + display);
}
}
|