I've tried reading the documentation, but there is no explanation of what is limit, mark etc. Annyoing thing is that the ByteBuffer.limit function's description says that it returns limit. now what is limit? Is it same or different from capacity...

End of the day, I want to know how many bytes I've 'put' into the buffer

If i allocate buffer with size 1024 and write the word "hello" into it. How can I get the result of 5 bytes written to the buffer?

Thanks