In this tutorial, we will check whether this associated buffer is based on a byte array or not, and provides read/write access.
The java.nio.ByteBuffer class extends java.nio.Buffer class. It provides the following methods:
| Return type | Method | Description |
| static ByteBuffer | wrap(byte[] b) | The wrap() method create a byte buffer by wrapping the associated byte array. |
| abstract boolean | hasArray() | The hasArray() method check associated buffer is based on byte array or not. |
import java.nio.*;
|
| C:\>java BufferHasArray ByteBuffer is based on array |