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

voidprint2DIntArray(int[][] array)
print D Int Array
print2DArray(getBoxedInt2DArray(array));
voidprint2DIntArray(int[][] nums)
print D Int Array
for (int[] array : nums) {
    for (int i : array) {
        System.out.print(i + ", ");
    System.out.println();
System.out.println();
voidprintMatrix(boolean[][] matrix)
print Matrix
if (matrix == null) {
    return;
int m = matrix.length;
if (m == 0) {
    return;
int n = matrix[0].length;
...
voidprintMatrix(byte[][] matrix)
print Matrix
int M = matrix.length;
int N = matrix[0].length;
for (int i = 0; i < M; i++)
    if (matrix[i].length != N)
        throw new IllegalArgumentException("Invalid matrix dimensions.");
System.out.printf("   ");
for (int j = 0; j < N; j++)
    System.out.printf("* %02d ", j);
...
voidprintMatrix(byte[][] matrix, boolean printMatrix)
Prints a byte[][] array as a matrix.
if (printMatrix) {
    for (int i = 0; i < matrix.length; ++i) {
        for (int j = 0; j < matrix[i].length; ++j) {
            System.out.printf("%02x ", matrix[i][j]);
        System.out.println();
    System.out.println();
...
voidprintMatrix(double data[][])
Generates a string with the contents of a data matrix
String exit = "";
String cad;
for (int i = 0; i < data.length; i++) {
    cad = "";
    for (int j = 0; j < data[0].length; j++) {
        cad += data[i][j] + "\t";
    exit += cad + "\n";
...
voidprintMatrix(double[] a, String label)
Print a vector for debugging purposes.
int count;
System.out.println("\n\t\t" + label + ":");
count = 0;
for (int j = 0; j < a.length; j++) {
    if (count > 8) {
        System.out.print("\n           ");
        count = 1;
    System.out.format(" %10.3e", a[j]);
    count++;
System.out.println();
voidprintMatrix(double[][] matrix)
print Matrix
for (double[] ds : matrix) {
    printVector(ds);
voidprintMatrix(double[][] matrix)
Prints the matrix to STDOUT
for (int i = 0; i < matrix.length; i++) {
    for (int j = 0; j < matrix[i].length; j++) {
        System.out.printf("%5.2f\t", matrix[i][j]);
    System.out.println();
voidprintMatrix(double[][] matrix)
print the specifield matrix
StringBuffer sb = new StringBuffer();
sb.append('[').append('\n');
for (double[] line : matrix) {
    for (double column : line) {
        sb.append(column).append(", ");
    sb.append('\n');
sb.append(']');
System.out.println(sb.toString());