Java Matrix to String matrixToString(String[][] m)

Here you can find the source of matrixToString(String[][] m)

Description

matrix To String

License

BSD License

Declaration

private static String matrixToString(String[][] m) 

Method Source Code

//package com.java2s;
//License from project: BSD License 

public class Main {
    private static String matrixToString(String[][] m) {
        StringBuilder expectedStr = new StringBuilder();
        expectedStr.append("{");

        for (String[] strings : m) {
            expectedStr.append("{");
            for (String s : strings) {
                expectedStr.append('"');
                expectedStr.append(s);/*from w ww  . j  ava  2 s .c  o m*/
                expectedStr.append('"');
                expectedStr.append(',');
            }
            expectedStr.deleteCharAt(expectedStr.length() - 1);
            expectedStr.append("},");
        }
        expectedStr.deleteCharAt(expectedStr.length() - 1);
        expectedStr.append("}");
        return expectedStr.toString();
    }
}

Related

  1. matrix_toString(int[][] matrix)
  2. matrixToString(double[][] matrix, int digit, String[] names)
  3. matrixToString(float[][][] matrix)
  4. matrixToString(int[][] m)
  5. matrixToString(int[][] matrix, String sep)
  6. toString(double[][] A)
  7. toString(double[][] array)
  8. toString(double[][] data)
  9. toString(int partition[][])