public class TestTreeSet {
public static void main(String[] args) {
byte b=-1;
int a=b;
String c=Integer.toBinaryString(a);
System.out.println(c);
}
}
输出11111111111111111111111111111111
public class TestTreeSet {
public static void main(String[] args) {
byte b=-1;
int a=b&255;
String c=Integer.toBinaryString(a);
System.out.println(c);
}
}
输出11111111
在byte类型转向int型是前三字节补1
加上&255前三字节补0 |