byte[] data = new byte[position - messageStartPosition]; buffer.position(messageStartPosition);
byte[] data = new byte[position - buffer.position()];
    private String getMessageString(ByteBuffer buffer) {        byte[] data = new byte[position - messageStartPosition];        buffer.position(messageStartPosition);        buffer.get(data);        return new String(data);    }