Java byte变成无符号整数~~~
代码
1 public class Test{
2
3 public static void main(String[] args) {
4
5 byte bytes = -42;
6
7 int result = bytes&0xff;
8 System.out.println("无符号数: \t"+result);
9 System.out.println("2进制bit位: \t"+Integer.toBinaryString(result));
10 }
11 }
kenkofox@qq.com
https://github.com/kenkozheng
欢迎投简历给我,一线大厂工作机会