In this tutorial, we will see the use of slice method of FloatBuffer class in java.
FloatBuffer API:
The java.nio.FloatBuffer class extends java.nio.Buffer class. It provides the following methods:
| Return type | Method | Description |
| static FloatBuffer | allocate( int capacity) | The allocate(..) method allocate a float buffer of given capacity. |
| abstract FloatBuffer | slice() | The slice() returns slice buffer that share the content of associated float buffer, and after the slicing position will be zero. |
import java.nio.*;
|
| C:\>java SliceFloatBuffer Information of float buffer. Position : 2 Capacity : 512 Limit : 512 Information of slice float buffer. Position : 0 Capacity : 2 Limit : 2 value in slice float buffer. 22.45 2.45 |