Java Bit Count bitLength(int num)

Here you can find the source of bitLength(int num)

Description

bit Length

License

BSD License

Declaration

public static int bitLength(int num) 

Method Source Code

//package com.java2s;
//License from project: BSD License 

public class Main {
    public static int bitLength(int num) {
        return (int) Math.ceil(Math.log((double) num) / Math.log(2));
    }// w  ww  .j  ava2s  .co  m
}

Related

  1. bitCount(int x)
  2. bitCount(String s)
  3. bitCountSlow(int x)
  4. bitLength(byte[] bytes)
  5. bitLength(final int byteLength)
  6. bitLength(int value)
  7. bitSizeForSignedValue(final int value)
  8. bitSizeForUnsignedValue(final int value)
  9. countBits (long v)