Here you can find the source of humanReadable(long number)
public static String humanReadable(long number)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; public class Main { public static String humanReadable(long number) { long absNumber = Math.abs(number); double result = number; String suffix = ""; if (absNumber < 1024L) { return String.valueOf(number); }/*from w w w . j av a2s . c om*/ if (absNumber < 1048576L) { result = number / 1024.0D; suffix = "k"; } else if (absNumber < 1073741824L) { result = number / 1048576.0D; suffix = "m"; } else { result = number / 1073741824.0D; suffix = "g"; } return new DecimalFormat("0.0").format(result) + suffix; } }