Java的byte数组和Integer互转

byte[] -> int

int result = ByteBuffer.wrap(bytes).getInt();

int -> byte[]

byte[] bytes = ByteBuffer.allocate(4).putInt(1695609641).array();

 

 

Leave a Reply

Your email address will not be published.