Mainly for internal use within the framework; consider Apache's Commons Lang for a more comprehensive suite of number utilities.
| Modifier and Type | Field and Description |
|---|---|
| private static final BigInteger | |
| private static final BigInteger | |
| public static final Set | STANDARD_NUMBER_TYPES
Standard number types (all immutable): Byte, Short, Integer, Long, BigInteger, Float, Double, BigDecimal. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static long | Returns: the long value, if convertible without overflowthe number to convert number, Class<? extends Number> the target class to convert to targetClass)Check for a |
| public static <T extends Number> T | Returns: the converted numberthe number to convert number, Class<T> the target class to convert to targetClass)Convert the given number into an instance of the given target class. |
| private static BigInteger | |
| private static boolean | isHexNumber(String value)
Determine whether the given |
| public static <T extends Number> T | Returns: the parsed numberthe text to convert text, Class<T> the target class to parse into targetClass)Parse the given |
| public static <T extends Number> T | Returns: the parsed numberthe text to convert text, Class<T> the target class to parse into targetClass, NumberFormat numberFormat)Parse the given |
| private static void | raiseOverflowException(Number
the number we tried to convert number, Class<?> the target class we tried to convert to targetClass)Raise an overflow exception for the given number and target class. |
| LONG_MAX | back to summary |
|---|---|
| private static final BigInteger LONG_MAX | |
| LONG_MIN | back to summary |
|---|---|
| private static final BigInteger LONG_MIN | |
| STANDARD_NUMBER_TYPES | back to summary |
|---|---|
| public static final Set<Class<?>> STANDARD_NUMBER_TYPES Standard number types (all immutable): Byte, Short, Integer, Long, BigInteger, Float, Double, BigDecimal. | |
| NumberUtils | back to summary |
|---|---|
| public NumberUtils() | |
| checkedLongValue | back to summary |
|---|---|
| private static long checkedLongValue(Number number, Class<? extends Number> targetClass) Check for a
| |
| convertNumberToTargetClass | back to summary |
|---|---|
| public static <T extends Number> T convertNumberToTargetClass(Number number, Class<T> targetClass) throws IllegalArgumentException Convert the given number into an instance of the given target class.
| |
| decodeBigInteger | back to summary |
|---|---|
| private static BigInteger decodeBigInteger(String value) Decode a Supports decimal, hex, and octal notation.
| |
| isHexNumber | back to summary |
|---|---|
| private static boolean isHexNumber(String value) Determine whether the given | |
| parseNumber | back to summary |
|---|---|
| public static <T extends Number> T parseNumber(String text, Class<T> targetClass) Parse the given Trims all whitespace (leading, trailing, and in between characters) from
the input Supports numbers in hex format (with leading "0x", "0X", or "#") as well.
| |
| parseNumber | back to summary |
|---|---|
| public static <T extends Number> T parseNumber(String text, Class<T> targetClass, NumberFormat numberFormat) Parse the given Trims the input
| |
| raiseOverflowException | back to summary |
|---|---|
| private static void raiseOverflowException(Number number, Class<?> targetClass) Raise an overflow exception for the given number and target class.
| |