Android examples for java.lang:String
Combine matrix to string
import java.io.UnsupportedEncodingException; import java.util.*; public class Main{ /**// w w w.ja v a 2 s . c o m * Combine matrix to string * * @param matrix char array to be combined * @return string corresponded to matrix */ public static String printMatrix(char[][] matrix) { StringBuffer resultSt = new StringBuffer(); int maxRow = matrix.length; for (int i = 0; i < maxRow; i++) { for (int j = 0; j < matrix[i].length; j++) { if ('\0' == matrix[i][j]) { resultSt.append(" "); } else { resultSt.append(matrix[i][j]); } } } return resultSt.toString(); } }