MCPcopy Create free account
hub / github.com/antlr/codebuff / floorPowerOfTwo

Method floorPowerOfTwo

output/java_guava/1.4.18/BigIntegerMath.java:71–74  ·  view source on GitHub ↗

Returns the largest power of two less than or equal to x. This is equivalent to BigInteger.valueOf(2).pow(log2(x, FLOOR)). @throws IllegalArgumentException if x <= 0 @since 20.0

(BigInteger x)

Source from the content-addressed store, hash-verified

69 */
70
71 @Beta
72 public static BigInteger floorPowerOfTwo(BigInteger x) {
73 return BigInteger.ZERO.setBit(log2(x, RoundingMode.FLOOR));
74 }
75
76 /**
77 * Returns {@code true} if {@code x} represents a power of two.

Callers

nothing calls this directly

Calls 1

log2Method · 0.95

Tested by

no test coverage detected