Java 如何将字节数组转换为整数值
我已将一个整数值存储为4个字节,但无法将其转换回整数Java 如何将字节数组转换为整数值,java,hex,Java,Hex,我已将一个整数值存储为4个字节,但无法将其转换回整数 byte[] pom = ByteBuffer.allocate(4).putInt(60000).array(); 在每个字节中,我的整数都有一个十六进制部分 arr[0] = 0 arr[1] = 0 arr[2] = ea arr[3] = 60 如何将其转换回整数?只需使用: int pomAsInt = ByteBuffer.wrap(pom).getInt();
byte[] pom = ByteBuffer.allocate(4).putInt(60000).array();
在每个字节中,我的整数都有一个十六进制部分
arr[0] = 0
arr[1] = 0
arr[2] = ea
arr[3] = 60
如何将其转换回整数?只需使用:
int pomAsInt = ByteBuffer.wrap(pom).getInt();