@@ -0,0 +1,1116 @@
+package study.hard.javalib.nativelib;%0A%0Aimport static org.junit.Assert.*;%0A%0Aimport org.junit.Test;%0A%0A/**%0A * A test case for shift operator.%0A * @author iandmyhand@gmail.com%0A */%0Apublic class ShiftOperatorTest %7B%0A%0A%09@Test%0A%09public void testShiftOperator() %7B%0A%09%09int i = 0;%0A%0A%09%09i = 2;%0A%09%09System.out.print(%22i: %22 + i);%0A%09%09System.out.println(%22 %5B%22 + getBit(i) + %22%5D%22);%0A%0A%09%09i = 2;%0A%09%09i = i %3C%3C 1;%0A%09%09System.out.print(%22i: %22 + i);%0A%09%09System.out.println(%22 %5B%22 + getBit(i) + %22%5D%22);%0A%09%09assertEquals(4, i);%0A%0A%09%09i = 2;%0A%09%09i = i %3C%3C 2;%0A%09%09System.out.print(%22i: %22 + i);%0A%09%09System.out.println(%22 %5B%22 + getBit(i) + %22%5D%22);%0A%09%09assertEquals(8, i);%0A%0A%09%09i = 8;%0A%09%09i = i %3E%3E 2;%0A%09%09System.out.print(%22i: %22 + i);%0A%09%09System.out.println(%22 %5B%22 + getBit(i) + %22%5D%22);%0A%09%09assertEquals(2, i);%0A%09%7D%0A%0A%09String getBit(int n) %7B%0A%09%09int%5B%5D array = new int%5B8%5D;%0A%09%09int iattr = (int)((byte)n & 0xFF);%0A%09%09int bitWise = 1;%0A%09%09for (int i = 0; i %3C 8; i++) %7B%0A%09%09%09if ((bitWise & iattr) %3E 0)%0A%09%09%09%09array%5Bi%5D = 1;%0A%09%09%09else%0A%09%09%09%09array%5Bi%5D = 0;%0A%09%09%09bitWise = (bitWise %3C%3C 1) & 0xfe;%0A%09%09%7D%0A%09%09StringBuilder sb = new StringBuilder();%0A%09%09for (int i = 0; i %3C array.length; ++i)%0A%09%09%09sb.append(array%5B7 - i%5D);%0A%09%09return sb.toString();%0A%09%7D%0A%7D%0A

Add test case for shift operator.