Integer.BitCount(Int32) Method

Definition

Returns the number of one-bits in the two's complement binary representation of the specified int value.

[Android.Runtime.Register("bitCount", "(I)I", "")]
public static int BitCount (int i);
[<Android.Runtime.Register("bitCount", "(I)I", "")>]
static member BitCount : int -> int

Parameters

i
Int32

the value whose bits are to be counted

Returns

the number of one-bits in the two's complement binary representation of the specified int value.

Attributes

Remarks

Returns the number of one-bits in the two's complement binary representation of the specified int value. This function is sometimes referred to as the population count.

Added in 1.5.

Java documentation for java.lang.Integer.bitCount(int).

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