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[] args) {
    FloatBuffer floatBuffer = FloatBuffer.wrap(new float[] { 1.23F }, 0, 1);

    floatBuffer.rewind();//from  ww  w.j  av a2  s. co  m

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

}

From source file:Main.java

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

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

    CharBuffer cb2 = cb1.subSequence(0, 2);

    System.out.println(cb2);

}

From source file:Main.java

public static void main(String[] args) throws UnsupportedEncodingException {
    String s = "Hello world";
    byte[] b = s.getBytes("US-ASCII");
    System.out.println(Arrays.toString(b));
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    byte[] ipAddr = new byte[] { 127, 0, 0, 1 };
    InetAddress addr = InetAddress.getByAddress(ipAddr);
    System.out.println(Arrays.toString(addr.getAddress()));
}

From source file:Main.java

public static void main(String[] args) {
    String hello = "aaaaaaaa";

    byte[] decoded = Base64.decodeBase64(hello.getBytes());

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

    String decodedString = new String(decoded);
    System.out.println(hello + " = " + decodedString);
}

From source file:Main.java

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

    bb.put(98765);/*from w w  w.  ja va2 s.  c  om*/

    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(0, 98765);// w  w  w .  jav a 2  s  . c  o  m

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

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    SecureRandom sr = new SecureRandom();

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

From source file:Main.java

public static void main(String[] args) {

    int[] intArray = { 1, 2, 3, 4 };
    Stream<int[]> singleElementStream = Stream.of(intArray);

    // OUTPUTS//w ww .  jav  a 2 s  .c  o m

    System.out.println(Arrays.toString(singleElementStream.toArray(Integer[]::new)));
    singleElementStream.toArray(); // watch it, it is Object[]
}

From source file:Base64Encode.java

public static void main(String[] args) {
    String hello = "Hello World";

    byte[] encoded = Base64.encodeBase64(hello.getBytes());

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

    String encodedString = new String(encoded);
    System.out.println(hello + " = " + encodedString);
}