Package com.helger.commons.math
Class FactorialHelper
java.lang.Object
com.helger.commons.math.FactorialHelper
Smart class for calculating factorials.
- Author:
- Philip Helger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum value for which pre-computed factorial values are presentstatic final intThe minimum value for which pre-computed factorial values are present -
Method Summary
Modifier and TypeMethodDescriptionstatic BigIntegergetAnyFactorialLinear(int n) static longgetSmallFactorial(int n) Calculate n!
-
Field Details
-
PREDEFINED_MIN_INDEX
public static final int PREDEFINED_MIN_INDEXThe minimum value for which pre-computed factorial values are present- See Also:
-
PREDEFINED_MAX_INDEX
public static final int PREDEFINED_MAX_INDEXThe maximum value for which pre-computed factorial values are present
-
-
Method Details
-
getSmallFactorial
Calculate n! whereas n must be in the range of 0 toPREDEFINED_MAX_INDEX.- Parameters:
n- Input value- Returns:
- The factorial value.
-
getAnyFactorialLinear
-