09/02/17 23:14:55
public class BitTest {
public static void main(String[] args) {
long i = 0;
for (i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE ; i ++) {
bittest((byte)i);
}
for (i = Integer.MIN_VALUE; i <= Integer.MAX_VALUE ; i ++) {
bittest((int)i);
}
}
public static void bittest(byte B_) {
byte c1 = (byte)((B_ & 0xFE) & 0xFF);
byte c2 = (byte)((B_ & 0xFE));
if (c1 != c2) {
System.out.println("error byte " + B_);
throw new RuntimeException();
}
}
public static void bittest(int B_) {
int c1 = (B_ & 0xFE) & 0xFF;
int c2 = (B_ & 0xFE);
if (c1 != c2) {
System.out.println("error int " + B_);
throw new RuntimeException();
}
}
}