Pretty print a matrix to stdout. - Android java.lang

Android examples for java.lang:Math Matrix

Description

Pretty print a matrix to stdout.

Demo Code


//package com.java2s;

public class Main {
    /**//from   ww w.j a v a 2s. co m
     * Pretty print a matrix to stdout.
     * @param matrix The matrix
     **/
    public static void printMatrix(float[][] matrix) {
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++)
                System.out.print(matrix[i][j] + "\t");
            System.out.println();
        }
    }
}

Related Tutorials