Code example for ByteBuffer

Methods: limitpositionremainingduplicate

        return new NodeId(id);
    public static NodeId wrap(ByteBuffer bb, int offset)
        ByteBuffer dup = bb.duplicate();
        dup.limit(dup.position() + LENGTH);
        return wrap(dup);
    private NodeId(ByteBuffer id)
        if (id.remaining() != LENGTH)
            throw new IllegalArgumentException("A NodeId representation is exactly " + LENGTH + " bytes");
 = id;
    public static NodeId generate() 
Connect your IDE to all the code out there  Get Codota for Java