public enum Maths extends Enum<Maths>
| Modifier and Type | Method and Description |
|---|---|
static long |
agitate(long l) |
static long |
divideRoundUp(long dividend,
long divisor)
Divide
dividend by divisor, if division is not integral the result is rounded up. |
static int |
hash32(CharSequence cs) |
static int |
hash32(long l0) |
static int |
hash32(String s) |
static int |
hash32(StringBuilder s) |
static long |
hash64(CharSequence cs) |
static long |
hash64(long l0)
A simple hashing algorithm for a 64-bit value
|
static long |
hash64(long l0,
long l1)
A simple hashing algorithm for a 128-bit value
|
static long |
hash64(String s) |
static long |
hash64(StringBuilder s) |
static int |
intLog2(long num)
Returns rounded down log2
num, e. |
static boolean |
isPowerOf2(long n) |
static int |
nextPower2(int n,
int min) |
static long |
nextPower2(long n,
long min) |
static double |
round1(double d)
Performs a round which is accurate to within 1 ulp.
|
static double |
round2(double d)
Performs a round which is accurate to within 1 ulp.
|
static double |
round3(double d)
Performs a round which is accurate to within 1 ulp.
|
static double |
round4(double d)
Performs a round which is accurate to within 1 ulp.
|
static double |
round5(double d)
Performs a round which is accurate to within 1 ulp.
|
static double |
round6(double d)
Performs a round which is accurate to within 1 ulp.
|
static double |
round7(double d)
Performs a round which is accurate to within 1 ulp.
|
static double |
round8(double d)
Performs a round which is accurate to within 1 ulp.
|
static double |
roundN(double d,
int digits)
Performs a round which is accurate to within 1 ulp.
|
static boolean |
same(double a,
double b) |
static boolean |
same(float a,
float b) |
static long |
tens(int decimalPlaces) |
static short |
toInt16(long x) |
static int |
toInt32(long x) |
static int |
toInt32(long x,
String msg) |
static byte |
toInt8(long x) |
static int |
toUInt16(long x) |
static int |
toUInt31(long x) |
static long |
toUInt32(long x) |
static short |
toUInt8(long x) |
static Maths |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Maths[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static Maths[] values()
for (Maths c : Maths.values()) System.out.println(c);
public static Maths valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static double roundN(double d,
int digits)
d - value to rounddigits - 0 to 18 digits of precisionpublic static double round1(double d)
d - value to roundpublic static double round2(double d)
d - value to roundpublic static double round3(double d)
d - value to roundpublic static double round4(double d)
d - value to roundpublic static double round5(double d)
d - value to roundpublic static double round6(double d)
d - value to roundpublic static double round7(double d)
d - value to roundpublic static double round8(double d)
d - value to roundpublic static int nextPower2(int n,
int min)
throws IllegalArgumentException
IllegalArgumentExceptionpublic static long nextPower2(long n,
long min)
throws IllegalArgumentException
IllegalArgumentExceptionpublic static boolean isPowerOf2(long n)
public static int hash32(@NotNull
CharSequence cs)
public static int hash32(@NotNull
String s)
public static int hash32(@NotNull
StringBuilder s)
public static int hash32(long l0)
public static long hash64(@NotNull
CharSequence cs)
public static long hash64(@NotNull
String s)
public static long hash64(@NotNull
StringBuilder s)
public static int intLog2(long num)
num, e. g.: intLog2(1) == 0,
intLog2(2) == 1, intLog2(7) == 2, intLog2(8) == 3, etc.IllegalArgumentException - if the given number <= 0public static byte toInt8(long x)
throws IllegalArgumentException
IllegalArgumentExceptionpublic static short toInt16(long x)
throws IllegalArgumentException
IllegalArgumentExceptionpublic static int toInt32(long x,
@NotNull
String msg)
throws IllegalArgumentException
IllegalArgumentExceptionpublic static int toInt32(long x)
throws IllegalArgumentException
IllegalArgumentExceptionpublic static short toUInt8(long x)
throws IllegalArgumentException
IllegalArgumentExceptionpublic static int toUInt16(long x)
throws IllegalArgumentException
IllegalArgumentExceptionpublic static int toUInt31(long x)
throws IllegalArgumentException
IllegalArgumentExceptionpublic static long toUInt32(long x)
throws IllegalArgumentException
IllegalArgumentExceptionpublic static long agitate(long l)
public static long hash64(long l0)
l0 - to hashpublic static long hash64(long l0,
long l1)
l0 - to hashl1 - to hashpublic static long divideRoundUp(long dividend,
long divisor)
dividend by divisor, if division is not integral the result is rounded up.
Examples: divideRoundUp(10, 5) == 2, divideRoundUp(11, 5) == 3,
divideRoundUp(-10, 5) == -2, divideRoundUp(-11, 5) == -3.public static long tens(int decimalPlaces)
public static boolean same(double a,
double b)
public static boolean same(float a,
float b)
Copyright © 2017. All rights reserved.