[java] Is there a method that calculates a factorial in Java?

Factorial is highly increasing discrete function.So I think using BigInteger is better than using int. I have implemented following code for calculation of factorial of non-negative integers.I have used recursion in place of using a loop.

public  BigInteger factorial(BigInteger x){     
    if(x.compareTo(new BigInteger("1"))==0||x.compareTo(new BigInteger("0"))==0)
        return new BigInteger("1");
    else return x.multiply(factorial(x.subtract(new BigInteger("1")))); 
}

Here the range of big integer is

-2^Integer.MAX_VALUE (exclusive) to +2^Integer.MAX_VALUE,
where Integer.MAX_VALUE=2^31.

However the range of the factorial method given above can be extended up to twice by using unsigned BigInteger.