// Tests to see whether the logical right shift operator works. // modified to defeat constant folding/copy propagation so // we make sure we're testing the runtime version of >>> class bitmask { public static void test1(int i_int) { int j_int = i_int >>> 24; if (j_int != 255) { System.out.println("Failed on source int, target int."); } } public static void test2(long i_long) { long j_long = i_long >>> 24; if (j_long != 0x000000ffffffffffL) { System.out.println("Failed on source long, target long."); } } public static void test3(long i_long) { int j_int = (int) (i_long >>> 56); if (j_int != 255) { System.out.println("Failed on source long, target int."); } } public static void test4(int i_int) { int j_int = i_int >>> 0; if (j_int != i_int) { System.out.println("Failed on shift 0."); } } public static void main(String args[]) { test1(-1); test2(-1); test3(-1); test4(-27); } }