Java Array to String arrayToString(final Object[] array)

Here you can find the source of arrayToString(final Object[] array)

Description

array To String

License

Open Source License

Parameter

Parameter Description
array an array to print

Return

a prettier string representation of the array

Declaration

public static String arrayToString(final Object[] array) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  ww  w.  j  av  a 2 s  .  c om
     * @param array an array to print
     * @return a prettier string representation of the array
     */
    public static String arrayToString(final Object[] array) {
        String result = "[";
        for (int i = 0; i < array.length; ++i) {
            result += array[i].toString();
            if (i < array.length - 1) {
                result += ", ";
            }
        }
        result += "]";
        return result;
    }
}

Related

  1. arrayToString(final byte[] array, final int start, final int length)
  2. arrayToString(final float[] array)
  3. arrayToString(final Object[] a)
  4. arrayToString(final Object[] arr)
  5. arrayToString(final Object[] array)
  6. arrayToString(final String[] args)
  7. arrayToString(final String[] strs)
  8. arrayToString(final String[] value)
  9. arrayToString(final String[] values)