62,614
社区成员
发帖
与我相关
我的任务
分享
package com.lzw;
import java.math.BigInteger;
public class Factorial
{
private static BigInteger temp = BigInteger.ONE;
private static BigInteger count = BigInteger.ONE;
public static BigInteger factorial(int num)
{
for (int i = 1; i <= num; i++)
{
temp = temp.multiply(count);
count = count.add(BigInteger.ONE);
}
return null;
}
public static void main(String[] args)
{
long start = System.currentTimeMillis();
BigInteger bi = factorial(99999);
long end = System.currentTimeMillis();
System.out.println(end-start);
}
}