Java Array Print printArrayToString(Object[] array)

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

Description

Print an Object ArrayHelper to a String.

License

Open Source License

Declaration

public static String printArrayToString(Object[] array) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from w ww. j av  a2s. c om
     * Print an Object ArrayHelper to a String.
     */
    public static String printArrayToString(Object[] array) {
        if (array == null)
            return "null";

        StringBuffer buffer = new StringBuffer();
        buffer.append('{');
        for (int i = 0; i < array.length; i++) {
            if (i > 0)
                buffer.append(',');
            buffer.append(array[i]);
        }
        buffer.append('}');
        return buffer.toString();
    }
}

Related

  1. printArrayElements(T[] array)
  2. printArrayFrom(int[] array, int start)
  3. printArrayInfo(int[] array)
  4. printArrayNoSpaces(int[] nums)
  5. printArrayRec(int[] workArray, int idx)
  6. printErrInvocationString(String cls, String[] args)
  7. printfirstBytes(String comment, byte[] input)
  8. printFloatArray(float[] arr)
  9. printFloatArray(float[] array)