Example usage for java.util Arrays toString

List of usage examples for java.util Arrays toString

Introduction

In this page you can find the example usage for java.util Arrays toString.

Prototype

public static String toString(Object[] a) 

Source Link

Document

Returns a string representation of the contents of the specified array.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    ByteBuffer bbuf = ByteBuffer.allocate(10);
    int capacity = bbuf.capacity(); // 10
    System.out.println(capacity);
    bbuf.putShort(2, (short) 123);
    System.out.println(Arrays.toString(bbuf.array()));

    System.out.println(bbuf.hasArray());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    ByteBuffer bbuf = ByteBuffer.allocate(10);
    int capacity = bbuf.capacity(); // 10
    System.out.println(capacity);
    bbuf.putShort(2, (short) 123);
    System.out.println(Arrays.toString(bbuf.array()));

    System.out.println(bbuf.arrayOffset());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    ByteBuffer bbuf = ByteBuffer.allocate(10);
    int capacity = bbuf.capacity(); // 10
    System.out.println(capacity);
    bbuf.putShort(2, (short) 123);
    System.out.println(Arrays.toString(bbuf.array()));

    System.out.println(bbuf.isReadOnly());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    ByteBuffer bbuf = ByteBuffer.allocate(10);
    int capacity = bbuf.capacity(); // 10
    System.out.println(capacity);
    bbuf.putShort(2, (short) 123);
    System.out.println(Arrays.toString(bbuf.array()));

    bbuf.flip();//from w  ww  .  j a  v a  2  s . co  m
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    ByteBuffer bbuf = ByteBuffer.allocate(10);
    int capacity = bbuf.capacity(); // 10
    System.out.println(capacity);
    bbuf.putShort(2, (short) 123);
    System.out.println(Arrays.toString(bbuf.array()));
    bbuf.mark();/*from   w  w  w.j  a  v  a  2s  .c o  m*/
    bbuf.reset();
    System.out.println(Arrays.toString(bbuf.array()));
}

From source file:Main.java

public static void main(String[] args) {
    ShortBuffer shortBuffer = ShortBuffer.allocate(10);
    shortBuffer.put((short) 100);

    shortBuffer.rewind();/*from   w ww .  ja  va  2s . com*/

    ShortBuffer shortBuffer2 = shortBuffer.compact();

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

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    String testStr = "one,   two, three";

    System.out.println("Original string: " + testStr);
    String[] result = testStr.split(",\\s*");
    System.out.print("Split at commas: ");
    System.out.println(Arrays.toString(result));

}

From source file:Main.java

public static void main(String args[]) {
    anArray = new double[10];
    Random rand = new Random();
    for (int i = 0; i < 10; i++) {
        anArray[i] = rand.nextInt();/*from www.j a  va2 s  .  c o m*/
    }
    System.out.println(Arrays.toString(anArray));
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    ByteBuffer bbuf = ByteBuffer.allocate(10);
    int capacity = bbuf.capacity(); // 10
    System.out.println(capacity);
    bbuf.put("java2s.com".getBytes(), 0, 2);
    System.out.println(Arrays.toString(bbuf.array()));
}

From source file:Main.java

public static void main(String[] args) {
    ShortBuffer shortBuffer = ShortBuffer.allocate(10);
    shortBuffer.put((short) 100);

    shortBuffer.rewind();// w w  w . j ava2 s  . co m

    ShortBuffer shortBuffer2 = shortBuffer.asReadOnlyBuffer();

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

}