Java????????????
???????????? ???????[ 2015/2/13 15:58:47 ] ????????Java ??????? ??????
??????λ
????λ?????д??????????????????λ????????λ????Java?У???????<<??>>????????????????????£?
????/* 00000001 << 1 = 00000010 */
????1 << 1 == 2
????/* 00000001 << 3 = 00001000 */
????1 << 3 == 8
????/* 11111111 11111111 11111111 11110000 >> 4 = 11111111 11111111 11111111 11111111 */
????0xFFFFFFF0 >> 4 == 0xFFFFFFFF
????/* 00001111 11111111 11111111 11111111 >> 4 = 00000000 11111111 11111111 11111111 */
????0x0FFFFFFF >> 4 == 0x00FFFFFF
?????????????λ???з????????????????????????Java????λ???????????????????????λ????1???????1??????????????λ??????1??????????0??????????????λ??????0??????????С???Java????????????н???λ??????
???????????y???“?????????”????????????????????>>> ???????“0”??????λ????????λ????????λ????????“0”?????
????/* 10000000 00000000 00000000 00000000 >>> 1 = 01000000 00000000 00000000 00000000 */
????0x80000000 >>> 1 == 0x40000000
????/* 10000000 00000000 00000000 00000000 >> 1 = 11000000 00000000 00000000 00000000 */
????0x80000000 >> 1 == 0xC0000000
???????????????????2?????1??????λ1λ??2????2λ??4????3λ??8…… ????????????1λ??????????????2??
???????????????????????λ????????????λ??????????????????е??Щ???λ??????????????????????????????????????
????00001000????????????????
????int bitmask = 1 << 3;
????????????λ????????????????????????????????????????λ???????????
????λ?????????
??????????Java???????????λ????????
????~ – ??λ???
????& – ??λ??
????~ – ??λ???
????| – ??λ??
????????????£??????????????????
????1010 & 0101 == 0000
????1100 & 0110 == 0100
????1010 | 0101 == 1111
????1100 | 0110 == 1110
????~1111 == 0000
????~0011 == 1100
????1010 ^ 0101 == 1111
????1100 ^ 0110 == 1010
???????磬????????“??”???????????????????????λ“????”?1????????????????λ??
????10000001 | 00100000 = 10100001 /* ????λ???1 */
????10000001 | 1 << 5 = 10100001 /* ??????? */
????00000000 | 1 << 2 | 1 << 5 = 00100100
??????Щ?????????????д????????????ж????????????????????????????????
????????????????????λ???0?????????????????1?????λ?0????????
????01010101 & ~(1<<2) == 01010101 & 11111011 == 01010001
????????λ???
?????????λ????????
????10010110
????^ ^
????| |------- ?? 0 λ
????|
????|-------------- ?? 7 λ
?????????0λ?????2^0?????λ??2^1??……????7λ?????2^7??
??????
???·???
??????????????????
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