Java - Unsigned right shift operator >>>

What is unsigned right shift operator?

The unsigned right shift operator >>> always fills the higher order bits with zero.

The result of 13 >>> 4 is zero whereas the result of -13 >>> 4 is 268435455.

There is no unsigned left shift operator.

13        00000000 00000000 00000000  00001101
13 >>> 4  00000000 00000000 00000000  00000000 1101

-13        11111111 11111111 11111111  11110011
-13 >>> 4  00001111 11111111 11111111  11111111 0011

Demo

public class Main {
  public static void main(String[] args) {
  
    System.out.println(13 >>> 4);
    System.out.println(-13 >>> 4);
  }//  w ww .  j a v  a  2s  .  c o  m
}

Result

Exercise