Java IO Tutorial - Java FloatBuffer.put(FloatBuffer src)








Syntax

FloatBuffer.put(FloatBuffer src) has the following syntax.

public FloatBuffer put(FloatBuffer src)

Example

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

import java.nio.FloatBuffer;
//from   ww w .  j a  va2s  . c  o  m
public class Main {
  public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);
    
    floatBuffer.put(0,1.23F);
    
    floatBuffer.rewind();
    
    FloatBuffer floatBuffer1 = FloatBuffer.allocate(10);
    
    floatBuffer1.put(floatBuffer);
    
    System.out.println(floatBuffer.arrayOffset());

  }
}

The code above generates the following result.