numberOfLeadingZeros
Returns the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specified Int value. Returns 32 if the value is zero.
Return
the number of leading zero bits in the two's complement binary representation of the specified int value; zero if the value is zero.
Parameters
the value whose leading zeros are to be counted
Returns the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specified long value. Returns 64 if the specified value has no one-bits in its two's complement representation, in other words if it is equal to zero.
Note that this method is closely related to the logarithm base 2. For all positive long values x:
floor(log2(x)) =
63 - numberOfLeadingZeros(x)ceil(log2(x)) =
64 - numberOfLeadingZeros(x - 1)
Return
the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specified long value, or 64 if the value is equal to zero.
Since
1.5
Parameters
the value whose number of leading zeros is to be computed