Returns true if x represents a power of two. This differs from Long.bitCount(x) == 1, because Long.bitCount(Long.MIN_VALUE) == 1, but Long#MIN_VALUE is not a power of two.
(long x)
| 99 | |
| 100 | |
| 101 | public static boolean isPowerOfTwo(long x) { |
| 102 | return x > 0 & (x & (x - 1)) == 0; |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * Returns 1 if {@code x < y} as unsigned longs, and 0 otherwise. Assumes that x - y fits into a |
no outgoing calls
no test coverage detected