public class Logs extends Object
| Constructor and Description |
|---|
Logs() |
| Modifier and Type | Method and Description |
|---|---|
static int |
binaryLogUp(int n)
Binary log: finds the smallest power k such that 2^k >= n
|
static int |
binaryLogUp(long n)
Binary log: finds the smallest power k such that 2^k >= n
|
static boolean |
isPowerOf2(int x) |
static int |
log2(int x) |
public static boolean isPowerOf2(int x)
public static int log2(int x)
throws IllegalArgumentException
x - where x == 2^n for some integer nIllegalArgumentExceptionpublic static int binaryLogUp(int n)
public static int binaryLogUp(long n)