Java byte λ????? ???????
???????????? ???????[ 2014/2/24 10:40:06 ] ??????????????? ????
????5 ????System.out.println();
????byte b = (byte)0xf8;
????System.out.println(b); --??????-8
?????????????
????b ????int 1111 1000 ???? 11111111 11111111 11111111 11111000
?????????λ - -1111111 11111111 11111111 11111000
???????+1???????????????? -0000000 00000000 00000000 00001000
??????? -8
??????????
????1 ??????? >> ?? >>>
????2 ?? >> ?????????? & 0xff
????3 ????????????????????????
????4 ??????????????? & ???????С?? + . ??? a = b & 0xff + 2000 ???? ??????????????
????????
???????byte??int ???bit????????
public static void printByte(byte b){
for(int i = 7; i >=0 ; i --){
int shiftleft = (b >> i) & 0x01;
System.out.print(shiftleft);
}
System.out.println();
}
public static void printInt(int b){
for(int i = 31; i >=0 ; i --){
int shiftleft = (b >> i) & 0x01;
System.out.print(shiftleft);
}
System.out.println();
}
|
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11