We use cookies to collect and analyze information on site performance and usage,
to provide social media features and to enhance and customize content and advertisements.
import java .io.*;
public class Test {
public static void main(String args[]) {
// a big file ...
File f = new File("news.easynews.com.newsrc");
System.out.println(f.length());
System.out.println(bytesToMeg(f.length()) + " Mb");
}
private static final long MEGABYTE = 1024L * 1024L;
public static long bytesToMeg(long bytes) {
return bytes / MEGABYTE ;
}
}