Test of unsigned right shift. : Shifting « Language Basics « Java






Test of unsigned right shift.

Test of unsigned right shift.
 
//: c03:URShift.java
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.

public class URShift {
  public static void main(String[] args) {
    int i = -1;
    System.out.println(i >>>= 10);
    long l = -1;
    System.out.println(l >>>= 10);
    short s = -1;
    System.out.println(s >>>= 10);
    byte b = -1;
    System.out.println(b >>>= 10);
    b = -1;
    System.out.println(b>>>10);
  }
} ///:~



           
         
  








Related examples in the same category

1.Demonstrates short-circuiting behavior with logical operatorsDemonstrates short-circuiting behavior with logical operators
2.Show some effects of shifting on ints and longsShow some effects of shifting on ints and longs
3.Right shift
4.Shift to the left three
5.Sign shift to the right
6.unSign shift to the right