Right shift : Shifting « Language Basics « Java






Right shift

 

public class Main {
  public static void main(String[] args) {
    int m = 15 % 4;
    System.out.println("m = " + m);
    m = 29;
    System.out.println("m >> 2 = " + (m >> 2));
  }
}

   
  








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.Shift to the left three
4.Sign shift to the right
5.unSign shift to the right
6.Test of unsigned right shift.Test of unsigned right shift.