forked from HarvardWestlake/SourceCodeTest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTester.java
More file actions
26 lines (23 loc) · 1017 Bytes
/
Tester.java
File metadata and controls
26 lines (23 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
public class Tester {
public static void main(String[] args){
int[][] matrix = {
{ 1, 2, 3, 4, 5, 6 },
{ 4, 5, 6, 3, 7, 2 },
{ 27, 8, 9, 5, 3, 21 },
{ 73, 2, 19, 5, 1, 8 },
{ 47, 9, 9, 5, 0, 22 },
{ 78, 86, 1, 4, 1, 21 }
};
int numRows = 6;
int numCols = 6; // Corrected the column size to match matrix1's column size
int[][] matrix2 = MatrixExample.generateRandomMatrix(numCols, numRows); // Fixed dimensions to match for multiplication
int[][] result = MatrixExample.multiplyMatrices(matrix, matrix2);
System.out.println("result length: " + result.length + " x " + result[0].length);
for (int i = 0; i < result.length; i++) {
for (int j = 0; j < result[i].length; j++) { // Fixed the loop here to use j instead of i
System.out.print(result[i][j] + " ");
}
System.out.println();
}
}
}