/** * 将高字节数组转换为int * @param b byte[] * @return int */ public static int hBytesToInt(byte[] b) { int s = 0; for (int i = 0; i < 3; i++) { if (b[i]>=0) { s = s+ b[i]; } else { s = s + 256 + b[i]; } s = s * 256; } if (b[3] >= 0) { s = s + b[3]; } else { s = s + 256 + b[3]; } return s; }