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) {
    int[] origNum = { 1, 2, 3 };
    System.out.println("Before method  call:" + Arrays.toString(origNum));

    // Pass the array to the method
    tryArrayChange(origNum);//ww  w .  j  ava2s . co m

    System.out.println("After method  call:" + Arrays.toString(origNum));
}

From source file:Main.java

public static void main(String[] args) {

    boolean[] arr1 = new boolean[] { true, false, false };

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

    // copying array arr1 to arr2 with range from index 1 to 4
    boolean[] arr2 = Arrays.copyOfRange(arr1, 1, 4);

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

From source file:Main.java

public static void main(String[] args) {
    String word = "abc|def";
    String[] splitted = word.split("\\|");
    System.out.println(Arrays.toString(splitted)); /* prints: [abc, def] */
}

From source file:Main.java

public static void main(String[] argv) {
    String[] rawStrings = { "B", "java2s.com", "b", "A", "a", "c", "C" };
    System.out.println(Arrays.toString(rawStrings));
    Arrays.sort(rawStrings, String.CASE_INSENSITIVE_ORDER);
    System.out.println(Arrays.toString(rawStrings));

}

From source file:Main.java

public static void main(String[] argv) {
    String str = "     j a v a 2 s.com    ";
    byte[] bytes = str.getBytes();
    System.out.println(Arrays.toString(bytes));
}

From source file:Main.java

public static void main(String[] args) {

    // initializing byte array
    byte[] b1 = new byte[] { 1, 29, 15 };

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

From source file:Main.java

public static void main(String args[]) {
    String[] myArray = new String[] { "A", "a", "B" };
    Arrays.sort(myArray);//from  w w w. jav  a  2 s .c  o  m
    System.out.println(Arrays.toString(myArray));
}

From source file:Main.java

public static void main(String[] args) {

    // initializing char array
    char[] c1 = new char[] { 'd', 'e', 'f' };

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

From source file:Main.java

public static void main(String[] args) {

    // initializing byte array
    byte arr[] = new byte[] { 1, 6, 3 };

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

    // using fill for placing 8
    // converting int to byte
    Arrays.fill(arr, (byte) 8);

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

From source file:Main.java

public static void main(String[] args) {

    // initializing boolean array
    boolean[] b1 = new boolean[] { true, false };

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