Java IO Tutorial - Java FloatBuffer.duplicate()








Syntax

FloatBuffer.duplicate() has the following syntax.

public abstract FloatBuffer duplicate()

Example

In the following code shows how to use FloatBuffer.duplicate() method.

import java.nio.FloatBuffer;
/*from  ww w  .  jav a 2  s  .c om*/
public class Main {
  public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);
    
    floatBuffer.put(0,1.23F);
    
    floatBuffer.rewind();
    
    FloatBuffer floatBuffer1 = floatBuffer.duplicate();
    
    System.out.println(floatBuffer.equals(floatBuffer1));

  }
}

The code above generates the following result.