Here you can find the source of matrix2string(int[][] matrix)
public static String matrix2string(int[][] matrix)
//package com.java2s; //License from project: Apache License public class Main { public static String matrix2string(int[][] matrix) { if (matrix == null || matrix.length == 0 || matrix[0].length == 0) return null; String str = String.valueOf(matrix[0][0]); for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix[0].length; j++) { if (i == 0 && j == 0) continue; str += " " + matrix[i][j]; }//from w w w.j a va2 s . c o m } return str; } }