Here you can find the source of printArray(int[][] array, String arrayLabel, String rowLabel, String columnLabel)
public static void printArray(int[][] array, String arrayLabel, String rowLabel, String columnLabel)
//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(); } }