The java.lang.Integer.numberOfLeadingZeros() method is used to return the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specified int value. The method returns 32 if the specified value has no one-bits in its two's complement representation, in other words if it is equal to zero.

For all positive int values x:

• floor(log2(x)) = 31 - numberOfLeadingZeros(x)
• ceil(log2(x)) = 32 - numberOfLeadingZeros(x - 1)

### Syntax

```public static int numberOfLeadingZeros(int i)
```

### Parameters

 `i` Specify the value whose number of leading zeros is to be computed.

### Return Value

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, or 32 if the value is equal to zero.

NA.

### Example:

In the below example, the java.lang.Integer.numberOfLeadingZeros() method is used to return the number of zero bits preceding the leftmost one-bit in the two's complement binary representation of the given int value.

```import java.lang.*;

public class MyClass {
public static void main(String[] args) {

//creating an int value
int x = 75;

//printing value of x, its binary
System.out.println("The values of x is: " + x);
System.out.print("The binary representation of x is: ");
System.out.println(Integer.toBinaryString(x));
```The values of x is: 75