liquibase-core/src/main/java/liquibase/util/NumberUtils.java
public static Number parseNumber(String text, Class targetClass) {
        String trimmed = text.trim();

        if (targetClass.equals(Byte.class)) {
            return Byte.decode(trimmed);
        } else if (targetClass.equals(Short.class)) {
            return Short.decode(trimmed);
        } else if (targetClass.equals(Integer.class)) {
            return Integer.decode(trimmed);
        } else if (targetClass.equals(Long.class)) {
            return Long.decode(trimmed);
        } else if (targetClass.equals(BigInteger.class)) {
            return decodeBigInteger(trimmed);
        } else if (targetClass.equals(Float.class)) {
            return Float.valueOf(trimmed);
        } else if (targetClass.equals(Double.class)) {
            return Double.valueOf(trimmed);
        } else if (targetClass.equals(BigDecimal.class) || targetClass.equals(Number.class)) {
            return new BigDecimal(trimmed);
        } else {
            throw new IllegalArgumentException(
                    "Cannot convert String [" + text + "] to target class [" + targetClass.getName() + "]");
        }
    }
public static Number parseNumber(String text, Class targetClass) {
        String trimmed = text.trim();

        if (targetClass.equals(Byte.class)) {
            return Byte.decode(trimmed);
        } else if (targetClass.equals(Short.class)) {
            return Short.decode(trimmed);
        } else if (targetClass.equals(Integer.class)) {
            return Integer.decode(trimmed);
        } else if (targetClass.equals(Long.class)) {
            return Long.decode(trimmed);
        } else if (targetClass.equals(BigInteger.class)) {
            return decodeBigInteger(trimmed);
        } else if (targetClass.equals(Float.class)) {
            return Float.valueOf(trimmed);
        } else if (targetClass.equals(Double.class)) {
            return Double.valueOf(trimmed);
        } else if (targetClass.equals(BigDecimal.class) || targetClass.equals(Number.class)) {
            return new BigDecimal(trimmed);
        } else {
            throw new IllegalArgumentException(
                    "Cannot convert String [" + text + "] to target class [" + targetClass.getName() + "]");
        }
    }
public static Number parseNumber ( String text , Class targetClass ) { String trimmed = text . trim ( ) ; if ( targetClass . equals ( Byte . class ) ) { return Byte . decode ( trimmed ) ; } else if ( targetClass . equals ( Short . class ) ) { return Short . decode ( trimmed ) ; } else if ( targetClass . equals ( Integer . class ) ) { return Integer . decode ( trimmed ) ; } else if ( targetClass . equals ( Long . class ) ) { return Long . decode ( trimmed ) ; } else if ( targetClass . equals ( BigInteger . class ) ) { return decodeBigInteger ( trimmed ) ; } else if ( targetClass . equals ( Float . class ) ) { return Float . valueOf ( trimmed ) ; } else if ( targetClass . equals ( Double . class ) ) { return Double . valueOf ( trimmed ) ; } else if ( targetClass . equals ( BigDecimal . class ) || targetClass . equals ( Number . class ) ) { return new BigDecimal ( trimmed ) ; } else { throw new IllegalArgumentException ( "Cannot convert String [" + text + "] to target class [" + targetClass . getName ( ) + "]" ) ; } }
Parse the given text into a number instance of the given target class,
using the corresponding default <code>decode</code> methods. Trims the
input <code>String</code> before attempting to parse the number. Supports
numbers in hex format (with leading 0x) and in octal format (with leading 0).

@param text        the text to convert
@param targetClass the target class to parse into
@return the parsed number
@throws IllegalArgumentException if the target class is not supported
(i.e. not a standard Number subclass as included in the JDK)
@see java.lang.Byte#decode
@see java.lang.Short#decode
@see java.lang.Integer#decode
@see java.lang.Long#decode
@see #decodeBigInteger(String)
@see java.lang.Float#valueOf
@see java.lang.Double#valueOf
@see java.math.BigDecimal#BigDecimal(String)
Parse the given text into a number instance of the given target class using the corresponding default <code > decode< / code > methods . Trims the input <code > String< / code > before attempting to parse the number . Supports numbers in hex format ( with leading 0x ) and in octal format ( with leading 0 ) .