Example usage for java.nio IntBuffer hasArray

List of usage examples for java.nio IntBuffer hasArray

Introduction

In this page you can find the example usage for java.nio IntBuffer hasArray.

Prototype

public final boolean hasArray() 

Source Link

Document

Indicates whether this buffer is based on a int array and is read/write.

Usage

From source file:Main.java

public static void main(String[] args) {
    IntBuffer bb = IntBuffer.allocate(10);
    bb.put(100);// w  w w  .jav a  2  s . c o m
    System.out.println(bb.hasArray());

}

From source file:com.moscona.dataSpace.debug.ByteBufferTest.java

public static void main(String[] args) {
    ByteBuffer bytes = ByteBuffer.allocate(40);
    print("after allocation", bytes);
    byte[] byteArray = bytes.array();
    for (int i = 0; i < byteArray.length; i++) {
        byteArray[i] = 1;//from w w  w .j  ava2s  .  c om
    }
    print("after filling with 1s", bytes);
    IntBuffer ints = bytes.asIntBuffer();
    System.out.println("ints has array: " + ints.hasArray());
    int[] array = ints.array();
    for (int i = 0; i < array.length; i++) {
        array[i] = 100 + i;
    }
    print("after filling ints array", bytes);
}