?? jiecheng.java~1~
字號:
package mypackage;import java.math.BigInteger;import java.util.*;public class JieCheng { protected static ArrayList table = new ArrayList(); static { table.add(BigInteger.valueOf(1)); } public static synchronized BigInteger factorial(int x){ if(x<0) throw new IllegalArgumentException("x must be non-negative"); for(int size = table.size();size<=x;size++){ BigInteger lastfact = (BigInteger)table.get(size-1); BigInteger nextfact = lastfact.multiply(BigInteger.valueOf(size)); table.add(nextfact); } return (BigInteger) table.get(x); } public static void main(String args[]){ int i=60; System.out.println(factorial(i)); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -