Java Matrix to String matrix2string(int[][] matrix)

Here you can find the source of matrix2string(int[][] matrix)

Description

matrixstring

License

Apache License

Declaration

public static String matrix2string(int[][] matrix) 

Method Source Code

//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;
    }
}

Related

  1. Array2DToString(double[][] array)
  2. array2DToString(int[][] grid)
  3. formatTable(String[][] table)
  4. matrix_toString(int[][] matrix)
  5. matrixToString(double[][] matrix, int digit, String[] names)
  6. matrixToString(float[][][] matrix)
  7. matrixToString(int[][] m)