In this tutorial, you will see how to create a short array with the help of short buffer.
In this tutorial, you will see how to create a short array with the help of short buffer.In this tutorial, we will see how to create a short array with the help of short buffer.
ShortBuffer API:
The java.nio.ShortBuffer class extends java.nio.Buffer class. It provides the following methods:
Return type | Method | Description |
static ShortBuffer | allocate( int capacity) | The allocate(..) method allocate a short buffer of given capacity. |
short[] | array() | The array() method returns short array based on short buffer. |
abstract short | get() | The get() method read short value from current position and increment position.. |
import java.nio.*;
|
C:\>java ShortBuffArray Capacity of short buffer : 1024 Content in shortbuffer : 43 44 45 Length of short buffer array : 1024 Content in short buffer array : 43 44 45 |