public class Maths extends Object
Constructor and Description |
---|
Maths() |
Modifier and Type | Method and Description |
---|---|
static long |
agitate(long l) |
static int |
compare(long x,
long y)
Compares two
long values numerically. |
static long |
hash(CharSequence cs) |
static int |
hash(int n) |
static long |
hash(long n) |
static int |
intLog2(long num) |
static boolean |
isPowerOf2(int n) |
static boolean |
isPowerOf2(long n) |
static int |
nextPower2(int n,
int min) |
static long |
nextPower2(long n,
long min) |
static long |
power10(int n) |
static double |
round2(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 |
round6(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 int |
toInt(long l,
String error) |
public static double round2(double d)
d
- value to roundpublic static double round4(double d)
d
- value to roundpublic static double round6(double d)
d
- value to roundpublic static double round8(double d)
d
- value to roundpublic static long power10(int n)
public static int nextPower2(int n, int min)
public static long nextPower2(long n, long min)
public static boolean isPowerOf2(int n)
public static boolean isPowerOf2(long n)
public static int hash(int n)
public static long hash(long n)
public static long hash(CharSequence cs)
public static int compare(long x, long y)
long
values numerically. The value returned is identical to what would be returned by:
Long.valueOf(x).compareTo(Long.valueOf(y))
x
- the first long
to comparey
- the second long
to compare0
if x == y
; a value less than 0
if x < y
; and a value greater
than 0
if x > y
public static int intLog2(long num)
public static int toInt(long l, String error)
public static long agitate(long l)
Copyright © 2019. All rights reserved.