Here you can find the source of bits(int i)
public static int bits(int i)
//package com.java2s; /**// w ww. j a va2 s . com * This code is released under the * Apache License Version 2.0 http://www.apache.org/licenses/. * * (c) Daniel Lemire, http://lemire.me/en/ */ public class Main { public static int bits(int i) { return 32 - Integer.numberOfLeadingZeros(i); } }