Java Array Output printArray(int[][] array, String arrayLabel, String rowLabel, String columnLabel)

Here you can find the source of printArray(int[][] array, String arrayLabel, String rowLabel, String columnLabel)

Description

print Array

License

Open Source License

Declaration

public static void printArray(int[][] array, String arrayLabel,
            String rowLabel, String columnLabel) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static void printArray(int[][] array, String arrayLabel,
            String rowLabel, String columnLabel) {
        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] + " ");
            }/*w  w w  . j a  va  2 s.c  o  m*/
            System.out.println();
        }
        System.out.println();
    }

    public static void printArray(int[] array, String arrayLabel,
            String columnLabel) {
        System.out.println(arrayLabel);
        for (int i = 0; i < array.length; i++) {
            if (columnLabel != null)
                System.out.print(columnLabel + ",");
            System.out.print(array[i] + " ");
        }
        System.out.println();
    }
}

Related

  1. printArray(final Object[] array, int indent)
  2. printArray(float[] arr)
  3. printArray(int arr[])
  4. printArray(int[] arr)
  5. printArray(int[] array)
  6. printArray(int[][] num)
  7. printArray(Object array)
  8. printArray(Object[] arry, String specialText)
  9. printArray(Object[] data)