Java Utililty Methods Array Print

List of utility methods to do Array Print

Description

The list of methods to do Array Print are organized into topic(s).

Method

voidprintArray(double[] a)
print Array
System.out.print("[");
for (double e : a) {
    System.out.print(e + ", ");
System.out.println("]");
voidprintArray(double[] array, String info)
print Array
System.out.println(info);
String outStr = "";
for (int i = 0; i < array.length; i++)
    outStr += array[i] + "\t";
System.out.println(outStr);
voidprintArray(double[] d)
Prints out the array in the format "[1.0, 2.0, 3.0]"
System.out.print("[");
for (int i = 0; i < d.length; ++i) {
    if (0 != i)
        System.out.print(",");
    System.out.print(d[i]);
System.out.println("]");
voidprintArray(E[] a)
print Array
System.out.println(Arrays.deepToString(a).replace("],", "],\n"));
voidprintArray(float[] array)
print Array
List<Float> output = new ArrayList<Float>();
for (float item : array) {
    output.add(item);
System.out.println(output);
voidprintArray(float[] spectrum)
print Array
if (spectrum == null) {
    System.out.println("null");
    return;
System.out.print("[");
for (int i = 0; i < (spectrum.length - 1); i++)
    System.out.print(spectrum[i] + ", ");
if (spectrum.length > 0)
...
voidprintArray(int A[])
print Array
System.out.println(Arrays.toString(A));
voidprintArray(int arr[])
Prints the contents of an int array to the comnand line.
for (int i = 0; i < arr.length; i++) {
    System.out.print(arr[i] + " ");
voidprintArray(int[] array)
print Array
for (int x : array) {
    System.out.println(x);
StringprintArray(int[] array)
Pretty prints an array of ints as a string.
String result = "[";
for (int i = 0; i < array.length; i++) {
    result += array[i];
    result += (i < (array.length - 1)) ? ", " : "";
result += "]";
return result;