# Shift operator in java – Java Program on Bitwise Unsigned Right Shift Operator

Shift operator in java: In the previous article we have discussed about Java Program on Bitwise Right Shift Operator

In this article we will see the use of Bitwise Unsigned Right Shift operator in Java programming language.

## Java Program on Bitwise Unsigned Right Shift Operator

Bitwise Unsigned Right Shift which is represented by >>> symbol. It shifts the bits of a number towards right with specified position.

During shift, the vacant left most positions are filled with 0 and excess right shifted positions are discarded.

Syntax:

value>>>position

Where

• value represents the binary value on which shift operation will be performed
• position refers to the specified position on which right shift will happen by shifting bits towards right with that position

For Example:

Suppose the number is 8 whose binary is 1000

We will perform 2 bit right shift then the value will become 0010 which is 2

Program-1:(2 bit unsigned right shift operation)

public class Main
{
public static void main(String args[])
{
//number declared 60
int x = 60;
//performing 2 bit unsigned right shift operation
int result=x>>>2;
System.out.println("After unsigned right shift operation: " + result);
}
}
Output:

After unsigned right shift operation: 15


Program-2:(2 bit unsigned right shift operation)

public class Main
{
public static void main(String args[])
{
//number declared
int x = 8;
int y= -8;
//performing 2 bit unsigned right shift operation
int resultX=x>>>2;
int resultY=y>>>2;
System.out.println("After unsigned right shift operation x: " + resultX);
System.out.println("After unsigned right shift operation y: " + resultY);
}
}
Output:

After unsigned right shift operation x: 2
After unsigned right shift operation y: 1073741822



Note: The signed and unsigned right shift operators provide different results for negative bits.

Guys who are serious about learning the concepts of the java programming language should practice this list of programs in java and get a good grip on it for better results in exams or interviews.

Related Java Programs: