public static String printArray(int[] array)
    {
        String result = "[";

        for (int i = 0; i < array.length; i++)
        {
            result += array[i];
            result += (i < (array.length - 1)) ? ", " : "";
        }

        result += "]";

        return result;
    }
public static String printArray ( int [ ] array ) { String result = "[" ; for ( int i = 0 ; i < array . length ; i ++ ) { result += array [ i ] ; result += ( i < ( array . length - 1 ) ) ? ", " : "" ; } result += "]" ; return result ; }
Pretty prints an array of ints as a string.

@param  array The array to pretty print.

@return The pretty printed string.