MCPcopy Create free account
hub / github.com/I-Rinka/BIT-Compile-Principle / main

Method main

Lab1/Java/src/Matrix_Multiply.java:6–37  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

4public class Matrix_Multiply {
5
6 public static void main(String[] args) {
7 int size = 1000;
8 int[][] matrix1 = new int[size][size];
9 int[][] matrix2 = new int[size][size];
10
11 for (int i = 0; i < matrix2.length; i++) {
12 for (int j = 0; j < matrix2[i].length; j++) {
13 matrix1[i][j] = i + 1;
14 matrix2[i][j] = i + 1;
15 }
16 }
17
18 int[][] ans = new int[size][size];
19 for (int i = 0; i < ans.length; i++) {
20 for (int j = 0; j < ans[i].length; j++) {
21 int tmp = 0;
22 for (int n = 0; n < ans.length; n++) {
23 tmp += matrix1[i][n] * matrix2[n][j];
24 }
25 ans[i][j] = tmp;
26 }
27 }
28
29 for (int i = 0; i < ans.length; i++) {
30 for (int j = 0; j < ans[i].length; j++) {
31 System.out.print(ans[i][j]);
32 System.out.print(',');
33 }
34 System.out.println();
35 }
36
37 }
38}

Callers

nothing calls this directly

Calls 1

printMethod · 0.45

Tested by

no test coverage detected