agave-systems/systems-core/src/main/java/org/iplantc/service/transfer/model/TransferTask.java
/**
	 * Parses numbers from abbreviated human readable form into human readable
	 * integers in gb.
	 * <ul>
	 * <li>1XB => 1000000000</li>
	 * <li>1EB => 1000000000</li>
	 * <li>1PB => 1000000</li>
	 * <li>1TB => 1000</li>
	 * <li>1GB => 1</li>
	 * </ul>
	 * @param memoryLimit a human readable memory value
	 * @return the numeric value of the human readable memory value
	 * @throws NumberFormatException if the human readable value is not valid
	 */
Parses numbers from abbreviated human readable form into human readable
integers in gb.
Parses numbers from abbreviated human readable form into human readable integers in gb .
public static long parseMaxMemory(String memoryLimit) throws NumberFormatException
	{
		if (memoryLimit == null) {
			throw new NumberFormatException("Cannot parse a null value.");
		} 
		memoryLimit = memoryLimit.toUpperCase()
				.replaceAll(",", "")
				.replaceAll(" ", "");
		Pattern patt = Pattern.compile("([\\d.-]+)([EPTGM]B)", Pattern.CASE_INSENSITIVE);
	    Matcher matcher = patt.matcher(memoryLimit);
	    Map<String, Integer> powerMap = new HashMap<String, Integer>();
	    powerMap.put("XB", 3);
	    powerMap.put("PB", 2);
	    powerMap.put("TB", 1);
	    powerMap.put("GB", 0);
		long returnValue;
		if (matcher.find()) {
			String number = matcher.group(1);
			int pow = powerMap.get(matcher.group(2).toUpperCase());
			BigDecimal bytes = new BigDecimal(number);
			bytes = bytes.multiply(BigDecimal.valueOf(1024).pow(pow));
			returnValue = bytes.longValue();
	    } else {
	    	throw new NumberFormatException("Invalid number format.");
	    }
	    return returnValue;
	}
public static long parseMaxMemory ( String memoryLimit ) throws NumberFormatException { if ( memoryLimit == null ) { throw new NumberFormatException ( "Cannot parse a null value." ) ; } memoryLimit = memoryLimit . toUpperCase ( ) . replaceAll ( "," , "" ) . replaceAll ( " " , "" ) ; Pattern patt = Pattern . compile ( "([\\d.-]+)([EPTGM]B)" , Pattern . CASE_INSENSITIVE ) ; Matcher matcher = patt . matcher ( memoryLimit ) ; Map < String , Integer > powerMap = new HashMap < String , Integer > ( ) ; powerMap . put ( "XB" , 3 ) ; powerMap . put ( "PB" , 2 ) ; powerMap . put ( "TB" , 1 ) ; powerMap . put ( "GB" , 0 ) ; long returnValue ; if ( matcher . find ( ) ) { String number = matcher . group ( 1 ) ; int pow = powerMap . get ( matcher . group ( 2 ) . toUpperCase ( ) ) ; BigDecimal bytes = new BigDecimal ( number ) ; bytes = bytes . multiply ( BigDecimal . valueOf ( 1024 ) . pow ( pow ) ) ; returnValue = bytes . longValue ( ) ; } else { throw new NumberFormatException ( "Invalid number format." ) ; } return returnValue ; }
Parses numbers from abbreviated human readable form into human readable
 integers in gb.
Parses numbers from abbreviated human readable form into human readable integers in gb .