Java ByteBuffer display content
import java.nio.ByteBuffer; public class Main { public static void main(String[] args) { ByteBuffer bb = ByteBuffer.allocate(2); System.out.println("Default Byte Order: " + bb.order()); bb.putShort((short) 67); bb.flip();/*from w w w. j a v a2 s.c o m*/ System.out.println("Byte Order: " + bb.order()); while (bb.hasRemaining()) { System.out.print(bb.get() + " "); } } }