The highestOneBit() method of Java Integer class returns an int value with at most a single one-bit, in the position of the highest-order one-bit in the specified int value.

 Syntax

public static int highestOneBit(int i)

 Parameters

The parameter ‘i’ represents the value whose highest one bit is to be calculated.

 Return Value

This method returns an int value with a single one-bit in the position of the highest-order.

Example 1

Output

Example 2

Output

Example 3

Output

Pin It on Pinterest

Share This