public static long parseMemorySize(String arg){
  if (arg.endsWith("g") || arg.endsWith("G"))   return Long.parseLong(arg.substring(0,arg.length() - 1)) * 1024 * 1024* 1024;
 else   if (arg.endsWith("m") || arg.endsWith("M"))   return Long.parseLong(arg.substring(0,arg.length() - 1)) * 1024 * 1024;
 else   if (arg.endsWith("k") || arg.endsWith("K"))   return Long.parseLong(arg.substring(0,arg.length() - 1)) * 1024;
 else   return Long.parseLong(arg.substring(0,arg.length()));
}

public static long parseMemorySize ( String arg ) { if ( arg . endsWith ( "g" ) || arg . endsWith ( "G" ) ) return Long . parseLong ( arg . substring ( 0 , arg . length ( ) - 1 ) ) * 1024 * 1024 * 1024 ; else if ( arg . endsWith ( "m" ) || arg . endsWith ( "M" ) ) return Long . parseLong ( arg . substring ( 0 , arg . length ( ) - 1 ) ) * 1024 * 1024 ; else if ( arg . endsWith ( "k" ) || arg . endsWith ( "K" ) ) return Long . parseLong ( arg . substring ( 0 , arg . length ( ) - 1 ) ) * 1024 ; else return Long . parseLong ( arg . substring ( 0 , arg . length ( ) ) ) ; }
parses a memory size with optional g / m / k quantifiers into its number representation .
