In this tutorial, we will see how to write the given short value into short buffer at the given index.
ShortBuffer API:
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 ShortBuffer | put(int index, short value) | The put(..) method write the given short value into associated buffer at given index. |
| abstract short | get( ) | The get(...) method returns short value from current position . |
import java.nio.*;
|
| C:\>java PutValueAtIndex Content in short buffer. 1 2 3 4 5 Put value at index . 2 Content in short buffer. 1 2 655 4 5 |
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.