byte型數組轉化成無符號整型 的函數
public static int byte2int(byte[] res)
{
int firstByte = (0x000000FF & ((int)res[0]));
int secondByte = (0x000000FF & ((int)res[1]));
int ToUnsignedInt = ((int)( firstByte << 8 |secondByte)) & 0xFFFFFFFF;
return ToUnsignedInt;
}
{
int firstByte = (0x000000FF & ((int)res[0]));
int secondByte = (0x000000FF & ((int)res[1]));
int ToUnsignedInt = ((int)( firstByte << 8 |secondByte)) & 0xFFFFFFFF;
return ToUnsignedInt;
}
posted on 2009-07-01 17:43 石頭@ 閱讀(2752) 評論(0) 編輯 收藏 所屬分類: java_base