答案 0 :(得分:1)
平移并求和(就像在DataInputStream#readInt()
中所做的那样)
byte[] bytes = {0, 0, 0x2, 0x24};
int i = ((bytes[0] << 24) + (bytes[1]<< 16) + (bytes[2]<< 8) + (bytes[3] << 0));
System.out.println(i);
输出:
548
也许您正在寻找DataInputStream
?
byte[] bytes = {0, 0, 0x2, 0x24};
DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(bytes));
System.out.println(inputStream.readInt());
输出:
548