List of usage examples for java.util Arrays toString
public static String toString(Object[] a)
From source file:Main.java
public static void main(String[] args) { // intializing an array arr1 char[] arr1 = new char[] { 'j', 'a', 'v' }; System.out.println(Arrays.toString(arr1)); // copying array arr1 to arr2 with range of index from 1 to 3 char[] arr2 = Arrays.copyOfRange(arr1, 1, 3); System.out.println(Arrays.toString(arr2)); }
From source file:Main.java
public static void main(String[] args) { // initializing unsorted int array int iArr[] = { 13, 11, 112, 18, 10 }; System.out.println(Arrays.toString(iArr)); // sorting array from index 0 to 3 Arrays.sort(iArr, 0, 3);// w w w. j a va 2s . co m System.out.println(Arrays.toString(iArr)); }
From source file:Main.java
public static void main(String[] args) { // initializing long array long arr[] = new long[] { 1, 6, 4, 49, 227 }; System.out.println(Arrays.toString(arr)); // using fill for placing 12 Arrays.fill(arr, 12);/*from ww w . j a v a2 s .c om*/ System.out.println(Arrays.toString(arr)); }
From source file:Main.java
public static void main(String[] args) { // initializing short array short arr[] = new short[] { 1, 2, 3, 4, 13 }; System.out.println(Arrays.toString(arr)); // using fill for placing 23 Arrays.fill(arr, (short) 23); System.out.println(Arrays.toString(arr)); }
From source file:Main.java
public static void main(String[] args) { // initializing unsorted short array short sArr[] = { 212, 1, 19, 2, 5 }; System.out.println(Arrays.toString(sArr)); // sorting array Arrays.sort(sArr);//from www .ja v a2s .com System.out.println(Arrays.toString(sArr)); }
From source file:Main.java
public static void main(String[] args) { // intializing an array arr1 short[] arr1 = new short[] { 1, 10, 15 }; System.out.println(Arrays.toString(arr1)); // copying array arr1 to arr2 with newlength as 5 short[] arr2 = Arrays.copyOf(arr1, 5); arr2[3] = 100;//from w w w . j a v a2 s .c o m arr2[4] = 200; System.out.println(Arrays.toString(arr2)); }
From source file:Main.java
public static void main(String[] args) { // initializing unsorted Object array Object ob[] = { 27, 11, 44, 22, 0 }; System.out.println(Arrays.toString(ob)); // sorting array Arrays.sort(ob);/*from w w w . j a v a 2s . c o m*/ System.out.println(Arrays.toString(ob)); }
From source file:Main.java
public static void main(String[] args) { // initializing unsorted short array short[] sArr = { 13, 13, 11, 9, 21 }; System.out.println(Arrays.toString(sArr)); // sorting array from index 1 to 4 Arrays.sort(sArr, 1, 4);// ww w . j av a 2 s . co m System.out.println(Arrays.toString(sArr)); }
From source file:Main.java
public static void main(String[] args) { // initializing unsorted long array long lArr[] = { 221, 10, 111, 62, 46 }; System.out.println(Arrays.toString(lArr)); // sorting array Arrays.sort(lArr);//from w w w . j av a 2s.co m System.out.println(Arrays.toString(lArr)); }
From source file:Main.java
public static void main(String[] args) { // initializing short array short arr[] = new short[] { 2, 3, 13, 23, 97 }; System.out.println(Arrays.toString(arr)); // using fill for placing 19 from index 1 to 3 Arrays.fill(arr, 1, 3, (short) 19); System.out.println(Arrays.toString(arr)); }