In this tutorial, we will see how to write and read double value from a byte buffer.
ByteBuffer API:
The java.nio.ByteBuffer class extends java.nio.Buffer class. It provides the following methods:
| Return type | Method | Description |
| static ByteBuffer | allocate(int capacity) | The allocate(..)method allocate a new byte buffer. |
| abstract ByteBuffer | putDouble() | The puDouble() method writes 8 byte containing the given double value into associated buffer. |
| abstract float | getDouble() | The getDouble() method read 8 byte from current position and increment position by 8. |
import java.nio.*;
|
| C:\>java GetDoubleValue Double data into byte buffer : 5822.0876 |