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

Syntax

public static int rotateLeft (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 left.

 Return Value

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

Example 1

Output

Example 2

Output

Example 3

Output

Pin It on Pinterest

Share This