Java Bit Get bits(int i)

Here you can find the source of bits(int i)

Description

bits

License

Open Source License

Declaration

public static int bits(int i) 

Method Source Code

//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);
    }
}

Related

  1. bitAt(byte b, int pos)
  2. bitAt(int offset, byte aByte)
  3. bitAt(int offset, byte aByte)
  4. bits(int i)
  5. bits(int n, int offset, int length)
  6. bits(int value, int c)
  7. bits(int value, int first, int last)