Java Utililty Methods Array Output

List of utility methods to do Array Output

Description

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

Method

voidprintArray(int[] array)
print Array
if (array != null) {
    for (int i = 0; i < array.length - 1; i++) {
        System.out.print(array[i] + ", ");
    System.out.println(array[array.length - 1]);
voidprintArray(int[][] array, String arrayLabel, String rowLabel, String columnLabel)
print Array
System.out.println(arrayLabel);
for (int i = 0; i < array.length; i++) {
    if (rowLabel != null)
        System.out.print(rowLabel + (i + 1) + ": ");
    for (int j = 0; j < array[i].length; j++) {
        if (columnLabel != null)
            System.out.print(columnLabel + ",");
        System.out.print(array[i][j] + " ");
...
voidprintArray(int[][] num)
print Array
for (int i = 0; i < num.length; i++) {
    for (int j = 0; j < num[i].length; j++)
        System.out.print(num[i][j] + "\t");
    System.out.println();
voidprintArray(Object array)
print Array
int maxmax = 10;
if (array instanceof float[]) {
    int maxI = ((float[]) array).length;
    if (maxI > maxmax)
        maxI = maxmax;
    System.out.print("[");
    for (int i = 0; i < maxI; i++) {
        System.out.print(((float[]) array)[i]);
...
voidprintArray(Object[] arry, String specialText)
print Array
for (int i = 0; i < arry.length; i++) {
    System.out.println(specialText + arry[i].toString());
voidprintArray(Object[] data)
Prints an array to the console
for (int i = 0; i < data.length; i++) {
    if (i != data.length - 1)
        System.out.print(data[i] + ", ");
    else
        System.out.print(data[i] + "\n");
StringprintArray(Object[] in)
print Array
if (in == null)
    return "null";
String out = "";
for (int i = 0; i < in.length; i++) {
    out += in[i].toString() + " ; ";
return out;
voidprintArray(String lt, String[] arr, String rt)
print Array
if (arr.length < 1)
    System.out.println("[EMPTY]");
else if (arr.length > 0) {
    for (int i = 0; i < arr.length; i++) {
        if (i < 9)
            System.out.println(" " + (i + 1) + lt + arr[i] + rt);
        else
            System.out.println("" + (i + 1) + lt + arr[i] + rt);
...
voidprintArray(String name, int[] array)
print Array
Integer[] temp = new Integer[array.length];
for (int i = 0; i < array.length; i++)
    temp[i] = Integer.valueOf(array[i]);
printArray(name, temp);
StringprintArray(T[] array)
print Array
StringBuilder builder = new StringBuilder();
for (int i = 0; i < array.length; i++)
    builder.append(array[i]);
return builder.toString();