public class NumberUtil
extends org.apache.commons.lang3.math.NumberUtils
NumberUtils 进行拓展| 构造器和说明 |
|---|
NumberUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T extends Number> |
add(T a,
T b,
int decimal)
a+b and Keep 'decimal' decimals
|
static BigDecimal |
decimalsXLength(int length,
BigDecimal old)
保留指定小数长度的数据
|
static <T extends Number> |
divide(T a,
T b,
int decimal)
a/b and Keep 'decimal' decimals
|
static <T extends Number> |
isNumbers(Class<T> type,
String... str)
判断字符串是否是数字(指定类型)
|
static boolean |
isNumbers(String... str)
判断字符串是否是数字(无法具体判断是整型还是浮点型)
|
static <T extends Number> |
multiply(T a,
T b,
int decimal)
a*b and Keep 'decimal' decimals
|
static <T extends Number> |
remainder(T a,
T b,
int decimal)
a%b and Keep 'decimal' decimals
|
static <T extends Number> |
subtract(T a,
T b,
int decimal)
like a-b and Keep 'decimal' decimals
|
compare, compare, compare, compare, createBigDecimal, createBigInteger, createDouble, createFloat, createInteger, createLong, createNumber, isCreatable, isDigits, isNumber, isParsable, max, max, max, max, max, max, max, max, max, max, max, max, min, min, min, min, min, min, min, min, min, min, min, min, toByte, toByte, toDouble, toDouble, toFloat, toFloat, toInt, toInt, toLong, toLong, toShort, toShortpublic static boolean isNumbers(String... str)
str - public static <T extends Number> boolean isNumbers(Class<T> type, String... str)
str - public static BigDecimal decimalsXLength(int length, BigDecimal old)
length - old - public static <T extends Number> BigDecimal add(T a, T b, int decimal)
T - must extend Numbera - b - decimal - public static <T extends Number> BigDecimal subtract(T a, T b, int decimal)
T - must extend Numbera - b - decimal - public static <T extends Number> BigDecimal divide(T a, T b, int decimal)
T - must extend Numbera - b - decimal - public static <T extends Number> BigDecimal multiply(T a, T b, int decimal)
T - must extend Numbera - b - decimal - public static <T extends Number> BigDecimal remainder(T a, T b, int decimal)
T - must extend Numbera - b - decimal - Copyright © 2019. All rights reserved.