Example usage for java.nio DoubleBuffer allocate

List of usage examples for java.nio DoubleBuffer allocate

Introduction

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

Prototype

public static DoubleBuffer allocate(int capacity) 

Source Link

Document

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

Usage

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(new double[] { 98765, 12345 });

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

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(new double[] { 98765, 12345 });

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

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);/* w  w w  . ja v a 2s. c o  m*/

    DoubleBuffer bb1 = bb.duplicate();

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

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);//from  w  ww. ja  v a 2 s.  c  om

    DoubleBuffer bb1 = bb.asReadOnlyBuffer();

    System.out.println(bb1.toString());

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);/*from  w  w w  .j a  va 2  s. co  m*/

    DoubleBuffer bb1 = bb.compact();

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

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);//from   w  w  w.  j av  a  2 s  .  c o  m

    DoubleBuffer bb1 = bb.slice();

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

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);//w w  w.  j  a  v a  2 s. co m

    DoubleBuffer bb1 = bb.compact();

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

    System.out.println(bb.compareTo(bb1));

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);/*from w  ww . ja  va2 s.  c o  m*/

    DoubleBuffer bb1 = DoubleBuffer.allocate(BSIZE);

    bb1.put(bb);

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

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);//from w  w  w  . j a v a  2 s . c  o m

    DoubleBuffer bb1 = DoubleBuffer.allocate(BSIZE);

    double[] doubleArray = new double[BSIZE];

    bb1.get(doubleArray);

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

}

From source file:Main.java

public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);
    bb.put(98765);//  w ww .  j  a v a2  s .  co m
    bb.put(98765);
    bb.put(98765);
    bb.put(98765);
    bb.put(98765);

    bb.rewind();

    double[] doubleArray = new double[BSIZE];

    bb.get(doubleArray, 0, 2);

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

}