fix numberUtil

This commit is contained in:
Looly 2020-09-28 08:44:45 +08:00
parent c3f187a713
commit ff10ea0d9c
3 changed files with 7 additions and 4 deletions

View File

@ -28,6 +28,7 @@
* 【dfa 】 SensitiveUtil增加setCharFilter方法pr#1123@Github * 【dfa 】 SensitiveUtil增加setCharFilter方法pr#1123@Github
* 【all 】 优化常量大小写规范pr#188@Gitee * 【all 】 优化常量大小写规范pr#188@Gitee
* 【core 】 优化NumberUtil中针对BigDecimal的一些处理逻辑pr#1127@Github * 【core 】 优化NumberUtil中针对BigDecimal的一些处理逻辑pr#1127@Github
* 【core 】 NumberUtil.factorial注释明确pr#1126@Github
### Bug修复 ### Bug修复
* 【crypto 】 修复SM2验签后无法解密问题issue#I1W0VP@Gitee * 【crypto 】 修复SM2验签后无法解密问题issue#I1W0VP@Gitee

View File

@ -1412,13 +1412,13 @@ public class NumberUtil {
// ------------------------------------------------------------------------------------------- others // ------------------------------------------------------------------------------------------- others
/** /**
* 计算阶乘 * 计算范围阶乘
* <p> * <p>
* n! = n * (n-1) * ... * end * factorial(start, end) = start * (start - 1) * ... * (end - 1)
* </p> * </p>
* *
* @param start 阶乘起始 * @param start 阶乘起始包含
* @param end 阶乘结束必须小于起始 * @param end 阶乘结束必须小于起始不包括
* @return 结果 * @return 结果
* @since 4.1.0 * @since 4.1.0
*/ */

View File

@ -245,6 +245,8 @@ public class NumberUtilTest {
Assert.assertEquals(120, factorial); Assert.assertEquals(120, factorial);
factorial = NumberUtil.factorial(5, 1); factorial = NumberUtil.factorial(5, 1);
Assert.assertEquals(120, factorial); Assert.assertEquals(120, factorial);
Assert.assertEquals(5, NumberUtil.factorial(5, 4));
} }
@Test @Test