Unsigned right shift ">>>" Operator

In this section, you will learn how to use unsigned right shift ">>>"operator
in Java. The Java programming language has operators that perform
bitwise operations. In the example below we have shown the usage of unsigned right shift ">>>"operator.
Description of code:
The unsigned right shift ">>>"operator
shifts a zero into the leftmost position
however the leftmost position after ">>" depends on sign extension. In
the program code given below, this operator has shifted the bits to the leftmost
position that is why we have got 19 as an output.
Here is the code of program:
public class Unrtshift{
public static void main(String args[]){
System.out.println( 78 >>> 2);
}
}
|
|
Output of the program:
C:\unique>javac Unrtshift.java
C:\unique>java Unrtshift
19
C:\unique> |
Download this example.

|