Java Unsigned Right Shift

Description

Java's unsigned, shift-right operator, >>>, always shifts zeros into the high-order bit.

Syntax

Its general form is shown here:


value >>> num

num specifies the number of positions to right-shift.

Example

The following code shows how to use unsigned right shift.


public class Main {
  public static void main(String[] argv) {
    int a = -1;/*  w  ww  .  j  a  v  a 2 s.c om*/
    a = a >>> 24;

    System.out.println("a is " + a);
  }
}

The output:





















Home »
  Java Tutorial »
    Java Language »




Java Data Type, Operator
Java Statement
Java Class
Java Array
Java Exception Handling
Java Annotations
Java Generics
Java Data Structures