bytes To Mega bytes - Java java.lang

Java examples for java.lang:long

Description

bytes To Mega bytes

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        long bytes = 2;
        System.out.println(bytesToMegabytes(bytes));
    }/*from  w ww  . j  av  a 2  s . c  o  m*/

    private static long bytesToMegabytes(long bytes) {
        long MEGABYTE = 1024L * 1024L;
        return bytes / MEGABYTE;
    }
}

Related Tutorials