Convert long value to megabytes based in Java
Description
The following code shows how to convert long value to megabytes based.
Example
/* w w w.j a v a2 s.c o m*/
public class Main {
public static void main(String args[]) {
long l = 9999999990L;
long MEGABYTE = 1024L * 1024L;
long b = l / MEGABYTE;
System.out.println(b + " Mb");
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »