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 {

    byte[] bytes = new byte[10];
    ByteBuffer buf = ByteBuffer.allocateDirect(10);
    buf = ByteBuffer.wrap(bytes);

    System.out.println(Arrays.toString(buf.array()));
    System.out.println(buf.toString());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");

    byte[] bytes = new byte[8];
    sr.nextBytes(bytes);// w  ww  .  ja  v a 2  s .co m
    System.out.println(Arrays.toString(bytes));
}

From source file:Main.java

public static void main(String[] args) {
    List<Integer> _numbers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    Object[] doubled = _numbers.stream().map(value -> value * 2).toArray();

    System.out.println(Arrays.toString(doubled));
}

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) {
    CharBuffer cb1 = CharBuffer.allocate(50);
    cb1.append("java2s.com");
    cb1.rewind();//from   www.  j  av a 2  s. c  o m

    System.out.println(cb1.arrayOffset());
    System.out.println(Arrays.toString(cb1.array()));

}

From source file:Main.java

public static void main(String[] args) {
    CharBuffer cb1 = CharBuffer.allocate(50);
    cb1.append("java2s.com");
    cb1.rewind();/*from w  ww. ja v a2s  .  c o m*/

    System.out.println(cb1.charAt(2));
    System.out.println(Arrays.toString(cb1.array()));

    CharBuffer cb2 = cb1.slice();
    System.out.println(Arrays.toString(cb2.array()));

}

From source file:Main.java

public static void main(String[] args) {
    CharBuffer cb1 = CharBuffer.allocate(50);
    cb1.append("java2s.com");
    cb1.rewind();/*from   ww  w  .  j  a  v  a 2 s  .c  o  m*/

    System.out.println(cb1.charAt(2));
    System.out.println(Arrays.toString(cb1.array()));

    CharBuffer cb2 = cb1.compact();
    System.out.println(Arrays.toString(cb2.array()));

}

From source file:Main.java

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

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

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

}

From source file:Main.java

public static void main(String[] args) {

    Short shortArr[] = new Short[] { 1, 2, 15, 50, 100 };

    // copy the array into another Number array
    Number[] arr2 = Arrays.copyOf(shortArr, 5, Number[].class);

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

}

From source file:Main.java

public static void main(String args[]) {
    String s[] = { "a", "b", "c", "d" };
    double d[][] = { { 0.50, 0.20, 0.20, 0.30 }, { 0.50, 1.10, 0.50, 0.80 }, { 0.50, 0.70, 0.40 },
            { 0.50, 0.70 }, { 0.50 }, };
    System.out.println(Arrays.toString(s));
    System.out.println(Arrays.deepToString(d));
}