Package com.semedy.reasoner.utils
Class Tools
java.lang.Object
com.semedy.reasoner.utils.Tools
- Author:
- angele
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
arraySize
(int expected, float f) Returns the least power of two smaller than or equal to 230 and larger than or equal toMath.ceil( expected / f )
.static long
nextPowerOfTwo
(long x) Return the least power of two greater than or equal to the specified value.static long
phiMix
(long x)
-
Constructor Details
-
Tools
public Tools()
-
-
Method Details
-
nextPowerOfTwo
public static long nextPowerOfTwo(long x) Return the least power of two greater than or equal to the specified value.Note that this function will return 1 when the argument is 0.
- Parameters:
x
- a long integer smaller than or equal to 262.- Returns:
- the least power of two greater than or equal to the specified value.
-
arraySize
public static int arraySize(int expected, float f) Returns the least power of two smaller than or equal to 230 and larger than or equal toMath.ceil( expected / f )
.- Parameters:
expected
- the expected number of elements in a hash table.f
- the load factor.- Returns:
- the minimum possible size for a backing array.
- Throws:
IllegalArgumentException
- if the necessary size is larger than 230.
-
phiMix
public static long phiMix(long x)
-