public static int ceilingNextPowerOfTwo(final int x){
  return 1 << (32 - Integer.numberOfLeadingZeros(x - 1));
}

public static int ceilingNextPowerOfTwo ( final int x ) { return 1 << ( 32 - Integer . numberOfLeadingZeros ( x - 1 ) ) ; }
calculate the next power of 2 , greater than or equal to x . < p > from hacker ' s delight , chapter 3 , harry s . warren jr .
