Here you can find the source of pow2(int c)
public static int pow2(int c)
//package com.java2s; //License from project: Apache License public class Main { public static int pow2(int c) { assert c > 0; c--;/* w ww . j a va 2s .com*/ c |= c >> 1; c |= c >> 2; c |= c >> 4; c |= c >> 8; c |= c >> 16; c++; return c; } }