用JAVA 把byte[]数组转成int整数
怎么做呢?
提供参考
[code="java"]public static int byteToInt2(byte[] b) {
int mask=0xff;
int temp=0;
int n=0;
for(int i=0;i<4;i++){
n<<=8;
temp=b[i]&mask;
n|=temp;
}
return n;
}[/code]
请参考:http://snowlotus.iteye.com/blog/246512
先对byte数组转成String,再把string转成int;
String str=new String(byte);
int i=Integer.valueof(str);