guava/src/com/google/common/math/IntMath.java
public static int factorial(int n) {
    checkNonNegative("n", n);
    return (n < factorials.length) ? factorials[n] : Integer.MAX_VALUE;
  }
public static int factorial(int n) {
    checkNonNegative("n", n);
    return (n < factorials.length) ? factorials[n] : Integer.MAX_VALUE;
  }
public static int factorial ( int n ) { checkNonNegative ( "n" , n ) ; return ( n < factorials . length ) ? factorials [ n ] : Integer . MAX_VALUE ; }
Returns {@code n!}, that is, the product of the first {@code n} positive integers, {@code 1} if
{@code n == 0}, or {@link Integer#MAX_VALUE} if the result does not fit in a {@code int}.

@throws IllegalArgumentException if {@code n < 0}
Returns { @code n! } that is the product of the first { @code n } positive integers { @code 1 } if { @code n == 0 } or { @link Integer#MAX_VALUE } if the result does not fit in a { @code int } .