[]
This class contains a collection of utility methods fro mathematical operations. All methods are static.
public class MathUtil
Name | Description |
---|---|
MathUtil() |
Name | Description |
---|---|
gcd(int, int) | Method that calculates the Greatest Common Divisor (GCD) of two positive integer numbers. |
gcd(int[]) | Method that calculates the Greatest Common Divisor (GCD) of several positive integer numbers. |
lcm(int, int) | Method that calculates the Least Common Multiple (LCM) of two strictly positive integer numbers. |
lcm(int[]) | Method that calculates the Least Common Multiple (LCM) of several positive integer numbers. |
log2(int) | Method that calculates the floor of the log, base 2, of 'x'. The calculation is performed in integer arithmetic, therefore, it is exact. |