public static String humanReadableInt(long number){
  long absNumber=Math.abs(number);
  double result=number;
  String suffix="";
  if (absNumber < 1024) {
  }
 else   if (absNumber < 1024 * 1024) {
    result=number / 1024.0;
    suffix="k";
  }
 else   if (absNumber < 1024 * 1024 * 1024) {
    result=number / (1024.0 * 1024);
    suffix="m";
  }
 else {
    result=number / (1024.0 * 1024 * 1024);
    suffix="g";
  }
  return oneDecimal.format(result) + suffix;
}

public static String humanReadableInt ( long number ) { long absNumber = Math . abs ( number ) ; double result = number ; String suffix = "" ; if ( absNumber < 1024 ) { } else if ( absNumber < 1024 * 1024 ) { result = number / 1024.0 ; suffix = "k" ; } else if ( absNumber < 1024 * 1024 * 1024 ) { result = number / ( 1024.0 * 1024 ) ; suffix = "m" ; } else { result = number / ( 1024.0 * 1024 * 1024 ) ; suffix = "g" ; } return oneDecimal . format ( result ) + suffix ; }
given an integer , return a string that is in an approximate , but human readable format . it uses the bases ' k ' , ' m ' , and ' g ' for 1024 , 1024 * * 2 , and 1024 * * 3 .
