java.math.BigInteger_100的阶乘的实现

来源:互联网 发布:淘宝如何刷好评赚钱 编辑:程序博客网 时间:2024/06/05 19:23

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)))));    
   }
}
}

 

原创粉丝点击