ByteBuffer bb = ByteBuffer.allocate (20);
bb.put ((byte)0x07);
bb.put ((byte)0x3b);
bb.put ((byte)0xc5);
bb.put ((byte)0x31);
bb.put ((byte)0x5e);
bb.put ((byte)0x94);
bb.put ((byte)0xd6);
bb.put ((byte)0x04);
bb.position (1).limit(5);
bb.mark();
int value;
value = bb.order (ByteOrder.BIG_ENDIAN).getInt();
System.out.println ("" + bb.order().toString() + ": "
+ Integer.toHexString (value));
bb.reset();
value = bb.order (ByteOrder.LITTLE_ENDIAN).getInt();
System.out.println ("" + bb.order().toString() + ": "
+ Integer.toHexString (value));
bb.reset();
System.out.println ("Expect an exception here");
System.out.println ("" + bb.order().toString() + ": "
+ bb.getLong());