public static long convertStringToMemorySizeLong(String memSize){
  long result=0;
  if (memSize.endsWith("K")) {
    result=Long.valueOf(StringUtils.remove(memSize,'K')) * 1000;
  }
 else   if (memSize.endsWith("M")) {
    result=Long.valueOf(StringUtils.remove(memSize,'M')) * 1000 * 1000;
  }
 else   if (memSize.endsWith("G")) {
    result=Long.valueOf(StringUtils.remove(memSize,'G')) * 1000 * 1000* 1000;
  }
  return result;
}

public static long convertStringToMemorySizeLong ( String memSize ) { long result = 0 ; if ( memSize . endsWith ( "K" ) ) { result = Long . valueOf ( StringUtils . remove ( memSize , 'K' ) ) * 1000 ; } else if ( memSize . endsWith ( "M" ) ) { result = Long . valueOf ( StringUtils . remove ( memSize , 'M' ) ) * 1000 * 1000 ; } else if ( memSize . endsWith ( "G" ) ) { result = Long . valueOf ( StringUtils . remove ( memSize , 'G' ) ) * 1000 * 1000 * 1000 ; } return result ; }
converts a string denoting an amount of bytes into an long value . strings are expected to follow this form where # equals a digit : # m the following are permitted for denoting binary size : k = kilobytes , m = megabytes , g = gigabytes
