List of utility methods to do Matrix to String
String | Array2DToString(double[][] array) print 2D array to string (matrix) final StringBuffer str = new StringBuffer(); int i = 0, j = 0; for (i = 0; i < array.length; i++) { for (j = 0; j < array[i].length; j++) { str.append(" " + array[i][j]); str.append("\n"); str.append("\n"); return str.toString(); |
String | array2DToString(int[][] grid) array D To String if (grid == null) { return null; StringBuilder sb = new StringBuilder(); sb.append("["); for (int i = 0; i < grid.length; i++) { sb.append(Arrays.toString(grid[i])); sb.append("]"); return sb.toString(); |
String | formatTable(String[][] table) Formats the given array of arrays of String s if (table == null) { throw new NullPointerException("table == null"); final List<List<String>> list = new ArrayList<List<String>>(); for (final String[] a : table) { final List<String> list2 = new ArrayList<String>(); for (final String s : a) { list2.add(s); ... |
String | matrix2string(int[][] matrix) matrixstring 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]; ... |
String | matrix_toString(int[][] matrix) matrito String StringBuilder sb = new StringBuilder(); for (int i = 0; i < matrix.length; i++) { sb.append("[ "); for (int j = 0; j < matrix[0].length; j++) { sb.append(matrix[i][j] + " "); sb.append("]\n"); return sb.toString(); |
String | matrixToString(double[][] matrix, int digit, String[] names) matrix To String StringBuilder output = new StringBuilder(); for (int i = 0; i < matrix.length; i++) { if (names != null) output.append(names[i]).append("\t"); output.append(arrayToString(matrix[i], digit)).append("\n"); return output.toString(); |
String | matrixToString(float[][][] matrix) Write the full matrix to a string StringBuffer out = new StringBuffer(); for (int k = 0; k < matrix[0][0].length; k++) { for (int i = matrix.length - 1; i >= 0; i--) { for (int j = 0; j < matrix[0].length; j++) { out.append(matrix[i][j][k]); out.append(SEPARATOR); out.append("\n"); ... |
String | matrixToString(int[][] m) Creates and returns a formatted string represenation of the input matrix m String str = ""; for (int i = 0; i < m.length; i++) { str += ((str.length() > 0) ? ",\n" : "") + "["; for (int j = 0; j < m[0].length; j++) str += m[i][j] + ((j < m[0].length - 1) ? ", " : ""); str += "]"; return str; ... |
String | matrixToString(int[][] matrix, String sep) matrix To String StringBuilder sb = new StringBuilder(); for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix[i].length; j++) { sb.append(matrix[i][j]).append(sep); sb.append("\n"); return sb.toString(); ... |
String | matrixToString(String[][] m) matrix To String StringBuilder expectedStr = new StringBuilder(); expectedStr.append("{"); for (String[] strings : m) { expectedStr.append("{"); for (String s : strings) { expectedStr.append('"'); expectedStr.append(s); expectedStr.append('"'); ... |