public final class QuickMath extends Object
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.Modifier and Type | Method and Description |
---|---|
static boolean |
isPowerOfTwo(int x)
Return true if input argument is power of two.
|
static int |
mod(int a,
int b)
Computes the remainder of the division of
a by b . |
public static boolean isPowerOfTwo(int x)
x
- true
if x
is power of twopublic static int mod(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
- Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.