Here you can find the source of sizeConvert(long size)
public static String sizeConvert(long size)
//package com.java2s; public class Main { public static String sizeConvert(long size) { if (size <= 1024) { return "1Kb"; } else if (size > 1024 && size < 1024 * 1024) { return size / 1024 + "Kb"; } else {//from www . jav a 2 s. co m return size / 1024 / 1024 + "M"; } } }