public class MathUtil extends Object
Constructor and Description |
---|
MathUtil() |
Modifier and Type | Method and Description |
---|---|
static int |
gcd(int[] x)
Method that calculates the Greatest Common Divisor (GCD) of several
positive integer numbers.
|
static int |
gcd(int x1,
int x2)
Method that calculates the Greatest Common Divisor (GCD) of two
positive integer numbers.
|
static int |
lcm(int[] x)
Method that calculates the Least Common Multiple (LCM) of several
positive integer numbers.
|
static int |
lcm(int x1,
int x2)
Method that calculates the Least Common Multiple (LCM) of two strictly
positive integer numbers.
|
static int |
log2(int x)
Method that calculates the floor of the log, base 2,
of 'x'.
|
public static int log2(int x)
x
- The value to calculate log2 on.public static final int lcm(int x1, int x2)
x1
- First numberx2
- Second numberpublic static final int lcm(int[] x)
x
- Array containing the numbers.public static final int gcd(int x1, int x2)
public static final int gcd(int[] x)
x
- Array containing the numbers.Copyright © 2015–2022 SCIFIO. All rights reserved.