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) {

    // initializing double array
    double arr[] = new double[] { 1.2, 5.6, 3.4, 2.3, 6.7 };

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

    // using fill for placing 1.2 from index 1 to 3
    Arrays.fill(arr, 1, 3, 1.2);/*from  w  w w  .j  av  a2  s.  c  o m*/

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

From source file:Main.java

public static void main(String[] args) {

    // initializing unsorted float array
    float fArr[] = { 13.2f, 1.2f, 0.7f, 1.2f, 4.5f };

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

    // sorting array
    Arrays.sort(fArr);// w ww  .ja v  a2  s.c om

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

From source file:Main.java

public static void main(String[] args) {

    // initializing unsorted float array
    float fArr[] = { 13.1f, 1.4f, 0.7f, 1.5f, 8.7f };

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

    // sorting array from index 0 to 3
    Arrays.sort(fArr, 0, 3);/*from   ww w  .j ava2s  .  c  o  m*/

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

From source file:Main.java

public static void main(String args[]) {
    int[] array = new int[] { 1, 2, 3 };

    Array.setInt(array, 1, 100);/*from  w w w . j ava  2 s .c o  m*/

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

}

From source file:Main.java

public static void main(String[] args) {
    IntBuffer bb = IntBuffer.wrap(new int[] { 0, 1, 2, 3, 4, 5, 6 });
    bb.put(100);/*from w  w w  .ja  va2 s  .  co m*/
    System.out.println(Arrays.toString(bb.array()));

}

From source file:Main.java

public static void main(String args[]) {
    int[] solutionArray = { 1, 2, 3, 4, 5, 6 };
    shuffleArray(solutionArray);/* ww w . j  av a  2  s. co  m*/
    System.out.println(Arrays.toString(solutionArray));
}

From source file:Main.java

public static void main(String[] args) {
    String[] s = { "a", "y", "x", "a", "d", "y", "m", "a", "bc" };
    System.out.println(Arrays.toString(s));
    System.out.println(Arrays.toString(clean(s)));
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int[] array = { 1, 2, 3 };

    System.arraycopy(array, 0, array, 1, array.length - 1);
    System.out.println(Arrays.toString(array));

    array = new int[] { 1, 2, 3 };
    System.arraycopy(array, 1, array, 0, array.length - 1);
    System.out.println(Arrays.toString(array));
}

From source file:Main.java

public static void main(String[] args) {
    int[] ids = new int[2];
    System.out.println(ids.length);
    System.out.println(Arrays.toString(ids));

    ids = (int[]) expandBy(ids, 2);

    ids[2] = 3;//from  w  w  w.  java 2s. c  o  m
    System.out.println(ids.length);
    System.out.println(Arrays.toString(ids));
}

From source file:Main.java

public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);
    floatBuffer.put(1.23F);/*w w  w. j a v a 2  s.  co  m*/

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

}