private boolean isCacheable( long size ) { return isPowerOfTwo( size ) && size <= maxCacheableBlockSize; } }
/** * Ensures that {@code value} is a power of 2 or throws {@link IllegalArgumentException} otherwise. * * @param value a value for check * @return {@code value} if it's a power of 2 * @throws IllegalArgumentException if {@code value} is not power of 2 */ public static long requirePowerOfTwo( long value ) { if ( !isPowerOfTwo( value ) ) { throw new IllegalArgumentException( "Expected long value to be a non zero power of 2, got " + value ); } return value; }
private boolean isCacheable( long size ) { return isPowerOfTwo( size ) && size <= maxCacheableBlockSize; } }
/** * Ensures that {@code value} is a power of 2 or throws {@link IllegalArgumentException} otherwise. * * @param value a value for check * @return {@code value} if it's a power of 2 * @throws IllegalArgumentException if {@code value} is not power of 2 */ public static long requirePowerOfTwo( long value ) { if ( !isPowerOfTwo( value ) ) { throw new IllegalArgumentException( "Expected long value to be a non zero power of 2, got " + value ); } return value; }