Here you can find the source of nextPowerOfTwo(int i)
private static int nextPowerOfTwo(int i)
//package com.java2s; //License from project: Open Source License public class Main { private static int nextPowerOfTwo(int i) { int minusOne = i - 1; minusOne |= minusOne >> 1; minusOne |= minusOne >> 2; minusOne |= minusOne >> 4; minusOne |= minusOne >> 8; minusOne |= minusOne >> 16; return minusOne + 1; }/*from w w w . jav a 2 s .c o m*/ }