Last active
January 12, 2019 12:53
-
-
Save bekwam/18d87c75bea368f954f37774fa3df7de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ByteBufferTest { | |
public static void main(String[] args) { | |
byte[] a = new byte[2]; | |
a[0] = (byte)0xff; | |
a[1] = (byte)0xcc; | |
ByteBuffer byteBuffer = ByteBuffer.allocate(2); | |
byteBuffer.put( a ); | |
byteBuffer.flip(); | |
byte[] b = new byte[2]; | |
byteBuffer.get(b, 0, 2); | |
System.out.println( String.format("%x %x", b[0], b[1]) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment