public final class Pow2 extends Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_POW2 |
Constructor and Description |
---|
Pow2() |
Modifier and Type | Method and Description |
---|---|
static long |
align(long value,
int alignment)
Align a value to the next multiple up of alignment.
|
static boolean |
isPowerOfTwo(int value) |
static int |
roundToPowerOfTwo(int value) |
public static final int MAX_POW2
public static int roundToPowerOfTwo(int value)
value
- from which next positive power of two will be found.IllegalArgumentException
- is value is more than MAX_POW2 or less than 0public static boolean isPowerOfTwo(int value)
value
- to be tested to see if it is a power of two.public static long align(long value, int alignment)
value
- to be aligned up.alignment
- to be used, must be a power of 2.Copyright © 2013–2018. All rights reserved.