mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
add isIn
This commit is contained in:
parent
7646683785
commit
768c4a392d
@ -946,6 +946,22 @@ public class NumberUtil {
|
||||
return Long.parseLong(binaryStr, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查值是否在指定范围内
|
||||
*
|
||||
* @param value 值
|
||||
* @param minInclude 最小值(包含)
|
||||
* @param maxInclude 最大值(包含)
|
||||
* @return 经过检查后的值
|
||||
* @since 5.8.5
|
||||
*/
|
||||
public static boolean isIn(final BigDecimal value, final BigDecimal minInclude, final BigDecimal maxInclude) {
|
||||
Assert.notNull(value);
|
||||
Assert.notNull(minInclude);
|
||||
Assert.notNull(maxInclude);
|
||||
return isGreaterOrEqual(value, minInclude) && isLessOrEqual(value, maxInclude);
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较大小,参数1 > 参数2 返回true
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user