ByteBuffer underflow
bytebuffer, java
Solution
As described in java docs
Relative get method. ...
Throws: BufferUnderflowException If the buffer's current position is not smaller than its limit
Find more here
Problem
I try to use the java libary ByteBuffer and wrote following code example: ``` ByteBuffer buf = ByteBuffer.allocate(32); buf.putInt(4); buf.putInt(8); buf.putInt(12); buf.putInt(16); buf.putInt(20); buf.putInt(24); buf.putInt(28); buf.putInt(32); buf.order(ByteOrder.LITTLE_ENDIAN); byte[] temp = new byte[32]; buf.get(temp); ``` For some reason it throws a BufferUnderflowException in the last line. I don't know why, can somebody explain me what I am doing wrong?