Here you can find the source of toString(int[][] matrix)
Parameter | Description |
---|---|
matrix | the matrix to format |
public static String toString(int[][] matrix)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; public class Main { /**/*from ww w . ja v a 2 s . co m*/ * Format matrix as String, by joining Arrays.toString of each row * @param matrix the matrix to format * @return the matrix String */ public static String toString(int[][] matrix) { StringBuilder builder = new StringBuilder(); builder.append("["); if (matrix.length > 0) { builder.append(Arrays.toString(matrix[0])); for (int i = 1; i < matrix.length; ++i) { builder.append(", ").append(Arrays.toString(matrix[i])); } } builder.append("]"); return builder.toString(); } }