Java Integer reverse() method

tutorial and example
tutorial and example

The reverse() method of Java Integer class returns the value obtained by reversing the order of the bits in the 2’s complement binary representation.

Syntax

public static int reverse (int i)

 Parameters

The parameter ‘i’ represents the value to be reversed.

 Return Value

This method returns the value obtained by reversing order of the bits in the specified int value.

Example 1

Output

Example 2

Output

Example 3

Output