📅  最后修改于: 2022-03-11 14:52:24.443000             🧑  作者: Mango
2.4. Factorial Using Apache Commons Math
Apache Commons Math has a CombinatoricsUtils class with a static factorial method that we can use to calculate the factorial.
To include Apache Commons Math, we'll add the commons-math3 dependency into our pom:
org.apache.commons
commons-math3
3.6.1
Let's see an example using the CombinatoricsUtils class:
public long factorialUsingApacheCommons(int n) {
return CombinatoricsUtils.factorial(n);
}