80,471
社区成员




DataInputStream dataInputStream = new DataInputStream(new ByteArrayInputStream(bytes));
int a = dataInputStream.readInt();
ByteBuffer buffer = ByteBuffer.allocate(4);
buffer.put((byte)255);
buffer.put((byte)255);
buffer.put((byte)255);
buffer.put((byte)255);
Log.d("TestFunc","结果:"+byteArrayToLong(buffer.array()));
byteArrayToLong(){
long a = 0;
for(int i = 0 ; i < 4 ; ++i){
a <<= 8;
a |= bytes[i];
}
return a;
}
return (long) (b4 & 0xFF) << 24 | (b3 & 0xFF) << 16 | (b2 & 0xFF) << 8 | (b1 & 0xFF);
即可