java.math.BigInteger_100的階乘的實現

import java.math.BigInteger;


public class TestYiBai {

public static void main(String[] args) {
   System.out.println(new TestYiBai().big(BigInteger.valueOf(100)).toString());
  
}


public BigInteger big(BigInteger b){
   if(b.equals(BigInteger.valueOf(1L))){
    return BigInteger.valueOf(1L);
   }else{
      return (b.multiply(big(b.subtract(BigInteger.valueOf(1L)))));    
   }
}
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章