Here you can find the source of getSizeDesc(long size)
public static String getSizeDesc(long size)
//package com.java2s; public class Main { public static String getSizeDesc(long size) { String suffix = "B"; if (size >= 1024) { suffix = "K"; size = size >> 10;//from w ww . j av a 2 s. c om if (size >= 1024) { suffix = "M"; //size /= 1024; size = size >> 10; if (size >= 1024) { suffix = "G"; size = size >> 10; //size /= 1024; } } } return size + suffix; } }