MathUtils { public static int nextPowerOfTwoValue( double value ) { int power = previousPowerOfTwo( value ); return 1 << power; }  static int round( double v ); static boolean isZero( double v ); static int previousPowerOfTwo( double value ); static int nextPowerOfTwoValue( double value ); static final double EPSILON; static final double SQRT2; }
@Test public void testNextPowerOfTwo() { assertEquals( 512, MathUtils.nextPowerOfTwoValue( 511 ) ); assertEquals( 512, MathUtils.nextPowerOfTwoValue( 512 ) ); assertEquals( 1024, MathUtils.nextPowerOfTwoValue( 513 ) ); }