Here you can find the source of factorial(BigInteger n)
Parameter | Description |
---|---|
n | a parameter |
public static BigInteger factorial(BigInteger n)
//package com.java2s; //License from project: Open Source License import java.math.BigInteger; public class Main { /**/*from w ww . j a v a 2 s .c om*/ * Naive (dumb) implementation of the factorial function. * @param n * @return */ public static BigInteger factorial(BigInteger n) { if (n.equals(BigInteger.ONE)) { return BigInteger.ONE; } return n.multiply(factorial(n.subtract(BigInteger.ONE))); } }