public final class Pow2
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
static int |
MAX_POW2 |
| Constructor | Description |
|---|---|
Pow2() |
| Modifier and Type | Method | 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.java.lang.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–2017. All rights reserved.