In this tutorial you will see how to clear a float buffer in java.
In this tutorial you will see how to clear a float buffer in java.In this tutorial, we will see how to clear a float buffer in java.
ByteBuffer 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 new float buffer of given capacity. |
abstract FloatBuffer | put(float f) | The put(..) method write a float value on the current position and increment position. |
abstract float | get() | The get() method read float value from buffer current position and increment the position. |
Buffer | flip() | The flip() method transfer the buffer from writing mode to reading mode. |
Buffer | clear() | The clear() method clean a buffer, and after clear the position will be zero and limit will be capacity of buffer. |
import java.nio.*;
|
C:\>java FloatBufferClear Before clear method data in buffer. 34.98 After clear method data in buffer. 675.87 |