Java BigInteger bitLength() MethodThe bitLength() method of Java BigInteger class returns an int value which corresponds to the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit. Syntax:Returns:This method returns number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit. Note:For positive BigIntegers, this is equivalent to the number of bits in the ordinary binary representation. It Computes (ceil (log2(this <0 " "this: this+1))).ExampleTest it NowOutput: Result of bitLength operation on 8 is 4 Result of bitLength operation on -9 is 4 Next TopicJava BigInteger |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India