public class IntMath
extends java.lang.Object
Constructor and Description |
---|
IntMath()
Creates a new instance of IntMath
|
Modifier and Type | Method and Description |
---|---|
static java.math.BigInteger |
gcd(java.math.BigInteger a,
java.math.BigInteger b)
Returns a long whose value is the greatest common divisor of
abs(a) and abs(b).
|
static int |
gcd(int a,
int b)
Returns an int whose value is the greatest common divisor of
abs(a) and abs(b).
|
static long |
gcd(long a,
long b)
Returns a long whose value is the greatest common divisor of
abs(a) and abs(b).
|
static void |
main(java.lang.String[] args) |
static int |
reverseBits(int a)
Reverses all 32 bits of the provided integer value.
|
static int |
reverseBits(int a,
int numBits)
Reverses specified number of bits of the provided integer value.
|
static java.math.BigInteger |
scm(java.math.BigInteger a,
java.math.BigInteger b)
Returns an int whose value is the smallest common multiple of
abs(a) and abs(b).
|
static int |
scm(int a,
int b)
Returns an int whose value is the smallest common multiple of
abs(a) and abs(b).
|
static long |
scm(long a,
long b)
Returns an int whose value is the smallest common multiple of
abs(a) and abs(b).
|
public static int gcd(int a, int b)
a
- value with with the GCD is to be computed.b
- value with with the GCD is to be computed.public static long gcd(long a, long b)
a
- value with with the GCD is to be computed.b
- value with with the GCD is to be computed.public static java.math.BigInteger gcd(java.math.BigInteger a, java.math.BigInteger b)
a
- value with with the GCD is to be computed.b
- value with with the GCD is to be computed.public static int scm(int a, int b)
a
- value with with the SCM is to be computed.b
- value with with the SCM is to be computed.public static long scm(long a, long b)
a
- value with with the SCM is to be computed.b
- value with with the SCM is to be computed.public static java.math.BigInteger scm(java.math.BigInteger a, java.math.BigInteger b)
a
- value with with the SCM is to be computed.b
- value with with the SCM is to be computed.public static int reverseBits(int a)
public static int reverseBits(int a, int numBits)
a
- The number.numBits
- The number of bits (must be between 1 and 32).public static void main(java.lang.String[] args)