Example usage for java.nio FloatBuffer allocate

List of usage examples for java.nio FloatBuffer allocate

Introduction

In this page you can find the example usage for java.nio FloatBuffer allocate.

Prototype

public static FloatBuffer allocate(int capacity) 

Source Link

Document

Creates a float buffer based on a newly allocated float array.

Usage

From source file:Main.java

public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);

    floatBuffer.put(0, 1.23F);// w  ww. ja  v  a  2s.  c  om

    floatBuffer.rewind();

    FloatBuffer floatBuffer1 = floatBuffer.slice();

    System.out.println(floatBuffer.equals(floatBuffer1));

}

From source file:Main.java

public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);

    floatBuffer.put(0, 1.23F);// ww  w  .j  a  v a 2 s . c o m

    floatBuffer.rewind();

    FloatBuffer floatBuffer1 = floatBuffer.compact();

    System.out.println(floatBuffer.equals(floatBuffer1));

}

From source file:Main.java

public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);

    floatBuffer.put(0, 1.23F);/*w ww  .  j av  a2s . c  o m*/

    floatBuffer.rewind();

    FloatBuffer floatBuffer1 = floatBuffer.compact();

    System.out.println(floatBuffer.compareTo(floatBuffer1));

}

From source file:Main.java

public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);

    floatBuffer.put(0, 1.23F);/* w ww  . ja v a2  s . c om*/

    floatBuffer.rewind();

    FloatBuffer floatBuffer1 = FloatBuffer.allocate(10);

    floatBuffer1.put(floatBuffer);

    System.out.println(floatBuffer.arrayOffset());

}

From source file:Main.java

public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);
    floatBuffer.put(1.23F);/* www  . j a  v  a2  s.  com*/

    System.out.println(Arrays.toString(floatBuffer.array()));

}

From source file:Main.java

public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);

    floatBuffer.put(1, 1.23F);/*w  w w  . j  ava2  s.  c om*/

    System.out.println(Arrays.toString(floatBuffer.array()));

}

From source file:Main.java

public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);

    floatBuffer.put(new float[] { 1.23F, 2.13F, 3.13F, 2.13F, }, 0, 2);

    System.out.println(Arrays.toString(floatBuffer.array()));

}

From source file:Main.java

public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);

    floatBuffer.put(new float[] { 1.23F });

    System.out.println(Arrays.toString(floatBuffer.array()));

}

From source file:Main.java

public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);

    floatBuffer.put(0, 1.23F);//from w  ww .j a  v a2s . c  o  m

    floatBuffer.rewind();

    float[] floatArray = new float[10];

    floatBuffer.get(floatArray);

    System.out.println(Arrays.toString(floatArray));

}

From source file:Main.java

public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);

    floatBuffer.put(0, 1.23F);/*from   ww w.j av  a2s.c o  m*/

    floatBuffer.rewind();

    float[] floatArray = new float[10];

    floatBuffer.get(floatArray, 0, 3);

    System.out.println(Arrays.toString(floatArray));

}