public class MathUtil
extends java.lang.Object
| Constructor and Description |
|---|
MathUtil() |
| Modifier and Type | Method and Description |
|---|---|
static long |
factorial(int n)
Compute the factorial of a value
Use this method for small values.
|
static long |
factorial2(int n)
Compute the factorial of a value
Use this method for large values.
|
static java.math.BigInteger |
fibonacci(int n) |
static int |
gcd(int m,
int n)
Return the greatest common divisor of two int values
|
static long |
gcd(long m,
long n)
Return the greatest common divisor of two long values
|
public static long gcd(long m,
long n)
m - n - public static int gcd(int m,
int n)
m - n - public static long factorial(int n)
factorial2n - must be >= 0@factorial2public static long factorial2(int n)
factorialn - must be >= 0@factorialpublic static java.math.BigInteger fibonacci(int n)