public final class MathUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static int |
safeFindNextPositivePowerOfTwo(int value)
Fast method of finding the next power of 2 greater than or equal to the supplied value.
|
public static int safeFindNextPositivePowerOfTwo(int value)
This method will do runtime bounds checking and call findNextPositivePowerOfTwo(int)
if within a
valid range.
value
- from which to search for next power of 2Special cases for return values are as follows:
<= 0
to 1>= 2^30
to 2^30