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 }

 

posted @ 2010-05-21 10:56  拂晓风起-Kenko  阅读(6419)  评论(1编辑  收藏  举报