public static String formatMemorySize(long arg){
  if (arg >= 1024 * 1024 * 1024)   return String.format("%d GB",arg / (1024 * 1024 * 1024));
 else   if (arg >= 1024 * 1024)   return String.format("%d MB",arg / (1024 * 1024));
 else   if (arg >= 1024)   return String.format("%d KB",arg / (1024));
 else   return String.format("%d",arg);
}

public static String formatMemorySize ( long arg ) { if ( arg >= 1024 * 1024 * 1024 ) return String . format ( "%d GB" , arg / ( 1024 * 1024 * 1024 ) ) ; else if ( arg >= 1024 * 1024 ) return String . format ( "%d MB" , arg / ( 1024 * 1024 ) ) ; else if ( arg >= 1024 ) return String . format ( "%d KB" , arg / ( 1024 ) ) ; else return String . format ( "%d" , arg ) ; }
format a memory size with g / m / k quantifiers into its number representation .
