Share via


BigInteger.BitLength Method

Definition

Returns the number of bits in the minimal two's-complement representation of this BigInteger, <em>excluding</em> a sign bit.

[Android.Runtime.Register("bitLength", "()I", "GetBitLengthHandler")]
public virtual int BitLength ();
[<Android.Runtime.Register("bitLength", "()I", "GetBitLengthHandler")>]
abstract member BitLength : unit -> int
override this.BitLength : unit -> int

Returns

number of bits in the minimal two's-complement representation of this BigInteger, <em>excluding</em> a sign bit.

Attributes

Remarks

Returns the number of bits in the minimal two's-complement representation of this BigInteger, <em>excluding</em> a sign bit. For positive BigIntegers, this is equivalent to the number of bits in the ordinary binary representation. For zero this method returns 0. (Computes (ceil(log2(this < 0 ? -this : this+1))).)

Java documentation for java.math.BigInteger.bitLength().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to