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

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

View File

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