67,513
社区成员
发帖
与我相关
我的任务
分享
public static void main(String[] args) throws Exception {
String str="好";
int res=byteToInt2(str.getBytes("gb2312"));
System.out.println(res);
}
public static int byteToInt2(byte[] b) {
int mask=0xff;
int temp=0;
int n=0;
for(int i=0;i<b.length;i++){
n<<=8;
temp=b[i]&mask;
n|=temp;
}
return n;
}