public class Util {
/**
* N的阶乘
*
* @param n
* @return
*/
public static int factorial(int n) {
if (n == 1) {
return 1;
} else {
return n * factorial(n - 1);
}
}
public static int factorial2(int n) {
int val = 1;
for (int i = 2; i <= n; i++) {
val *= i;
}
return val;
}
}