Here you can find the source of minLog2(int input)
public static int minLog2(int input)
//package com.java2s; public class Main { public static int minLog2(int input) { int bitMask = 1; int bitPosition = 0; int maxBitMask = 0; while (bitPosition < 31) { if ((bitMask & input) > 0) { maxBitMask = (bitMask & input); }//from w w w. j a va 2 s . c o m bitMask <<= 1; bitPosition++; } return maxBitMask; } }