Code example for ByteBuffer

Methods: limit, position

0
    } 
 
    @Override 
    public IntBufferIndexedInts fromByteBuffer(ByteBuffer buffer, int numBytes)
    { 
      buffer.limit(buffer.position() + numBytes);
      return new IntBufferIndexedInts(buffer);
    } 
 
    @Override 
    public byte[] toBytes(IntBufferIndexedInts val)
    { 
      ByteBuffer buffer = val.getBuffer();
      byte[] bytes = new byte[buffer.remaining()];
      buffer.get(bytes);
 
      return bytes;
    } 
 
    @Override 
    public int compare(IntBufferIndexedInts o1, IntBufferIndexedInts o2)