In this tutorial, we will see how to create a shortt buffer by using wrap method of ShorttBuffer class.
The java.nio.ShortBuffer class extends java.nio.Buffer class. It provides the following methods:
| Return type | Method | Description |
| static ShortBuffer | wrap(short[] array) | The wrap() method create a short buffer by wrapping the associated short array. |
| abstract short | get() | The get() method read short value from current position and increment position.. |
import java.nio.*;
|
| C:\>java WrapShortBuffer Limit of short buffer : 3 capacity of short buffer : 3 Content in shortbuffer. 12 34 56 |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.