|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.hazelcast.util.QuickMath
public final class QuickMath
The class QuickMath
contains methods to perform optimized mathematical operations.
Methods are allowed to put additional constraints on the range of input values if required for efficiency.
Methods are not required to perform validation of input arguments, but they have to indicate the constraints
in theirs contract.
Method Summary | |
---|---|
static int |
compareIntegers(int i1,
int i2)
Compares two integers |
static int |
compareLongs(long l1,
long l2)
Compares two longs |
static int |
divideByAndCeilToInt(double d,
int k)
|
static long |
divideByAndCeilToLong(double d,
int k)
|
static int |
divideByAndRoundToInt(double d,
int k)
|
static long |
divideByAndRoundToLong(double d,
int k)
|
static boolean |
isPowerOfTwo(long x)
Return true if input argument is power of two. |
static int |
log2(int value)
|
static int |
log2(long value)
|
static int |
modPowerOfTwo(int a,
int b)
Computes the remainder of the division of a by b . |
static long |
modPowerOfTwo(long a,
int b)
Computes the remainder of the division of a by b . |
static int |
nextPowerOfTwo(int value)
|
static long |
nextPowerOfTwo(long value)
|
static int |
normalize(int value,
int factor)
|
static long |
normalize(long value,
int factor)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean isPowerOfTwo(long x)
x
-
true
if x
is power of twopublic static int modPowerOfTwo(int a, int b)
a
by b
.
a
has to be non-negative integer and b
has to be power of two
otherwise the result is undefined.
a
- b
-
public static long modPowerOfTwo(long a, int b)
a
by b
.
a
has to be non-negative integer and b
has to be power of two
otherwise the result is undefined.
a
- b
-
public static int nextPowerOfTwo(int value)
public static long nextPowerOfTwo(long value)
public static int log2(int value)
public static int log2(long value)
public static int divideByAndCeilToInt(double d, int k)
public static long divideByAndCeilToLong(double d, int k)
public static int divideByAndRoundToInt(double d, int k)
public static long divideByAndRoundToLong(double d, int k)
public static int normalize(int value, int factor)
public static long normalize(long value, int factor)
public static int compareIntegers(int i1, int i2)
i1
- First number to compare with second onei2
- Second number to compare with first one
public static int compareLongs(long l1, long l2)
l1
- First number to compare with second onel2
- Second number to compare with first one
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |