Java Integer rotateRight() method

The rotateRight() method of Java Integer class returns the value obtained by rotating the  2’s complement binary representation of the given integer value right by the specified number of bits.

Syntax

public static int rotateRight (int i , int distance)

 Parameters

The parameter ‘i’ represents the bytes whose value is to be reversed and parameter ‘distance’ represents the number of bit positions to rotate right.

 Return Value

This method returns the value obtained by rotating the 2’s complement binary representation of the integer value right by the specified number of bits.

Example 1

Output

Example 2

Output

Example 3

Output