public static BigDecimal strToAmount(@CurrencyAmountStr final String amount) {
        if (amount == null) {
            return null;
        }
        final int dot = amount.indexOf('.');
        final int scale;
        final String unscaledStr;
        if (dot == -1) {
            scale = 0;
            unscaledStr = amount;
        } else {
            scale = amount.length() - dot - 1;
            unscaledStr = amount.substring(0, dot) + amount.substring(dot + 1);
        }
        final BigInteger unscaled = new BigInteger(unscaledStr);
        return new BigDecimal(unscaled, scale);
    }
public static BigDecimal strToAmount ( @ CurrencyAmountStr final String amount ) { if ( amount == null ) { return null ; } final int dot = amount . indexOf ( '.' ) ; final int scale ; final String unscaledStr ; if ( dot == - 1 ) { scale = 0 ; unscaledStr = amount ; } else { scale = amount . length ( ) - dot - 1 ; unscaledStr = amount . substring ( 0 , dot ) + amount . substring ( dot + 1 ) ; } final BigInteger unscaled = new BigInteger ( unscaledStr ) ; return new BigDecimal ( unscaled , scale ) ; }
Converts an amount from it's canonical string representation back into a big decimal. A <code>null</code> argument will return
<code>null</code>.

@param amount
Amount string to convert.

@return String as big decimal.