Java Utililty Methods Matrix Print

List of utility methods to do Matrix Print

Description

The list of methods to do Matrix Print are organized into topic(s).

Method

voidprintMatrix(int[][] matrix)
print Matrix
for (int i = 0; i < matrix.length; i++) {
    for (int j = 0; j < matrix[i].length; j++) {
        if (matrix[i][j] < 10 && matrix[i][j] > -10) {
            System.out.print(" ");
        if (matrix[i][j] < 100 && matrix[i][j] > -100) {
            System.out.print(" ");
        if (matrix[i][j] >= 0) {
            System.out.print(" ");
        System.out.print(" " + matrix[i][j]);
    System.out.println();
voidprintMatrix(int[][] s)
print Matrix
for (int i = 0; i < s.length; i++) {
    System.out.println(Arrays.toString(s[i]));
voidprintMatrix(int[][] target)
print Matrix
if (target == null) {
    System.out.println("NULL");
    return;
int n = target.length;
for (int i = 0; i < n; i++) {
    int m = target[i].length;
    for (int j = 0; j < m; j++) {
...
StringprintMatrix(Object[][] matrix)
Prints a matrix to console
StringBuilder builder = new StringBuilder("");
int rowCount = matrix.length;
if (rowCount == 0) {
    System.out.println("Matrix is empty");
    return "Matrix is empty";
int columnCount = matrix[0].length;
for (int i = 0; i < rowCount; i++) {
...
voidprintMatrix(Object[][] matrix)
print Matrix
for (Object[] wid : matrix) {
    for (Object type : wid) {
        System.out.print(type + " ");
    System.out.println();
voidprintMatrix(Object[][] matrix)
Displays a matrix of Objects.
int numRows = matrix[0].length;
int numCols = matrix.length;
System.out.println("Matrix of " + matrix[0][0].getClass().getSimpleName() + ": [");
for (int y = 0; y < numRows; y++) {
    System.out.print("    row " + y + ": [");
    for (int x = 0; x < numCols; x++) {
        System.out.print(matrix[x][y]);
        if (x != numCols - 1) {
...
voidprintMatrix(PrintStream out, double[][] matrix)
print Matrix
for (int r = 0; r < matrix.length; r++) {
    for (int c = 0; c < matrix[r].length; c++) {
        out.print(matrix[r][c] + " ");
    out.println();
voidprintMatrixGeneric(boolean[][] matrix)
print Matrix Generic
System.out.println("Matrix is: ");
for (boolean[] row : matrix) {
    for (boolean t : row) {
        System.out.print(t + "\t");
    System.out.println();
System.out.println("----------------------------------------------------");
...