Here you can find the source of ceilingNextPowerOfTwo(final int x)
public static int ceilingNextPowerOfTwo(final int x)
//package com.java2s; //License from project: Open Source License public class Main { public static int ceilingNextPowerOfTwo(final int x) { return 1 << (32 - Integer.numberOfLeadingZeros(x - 1)); }// w w w .j a va 2 s .co m }