我试图创建一个方法,将2个双暗数组作为参数并打印它们的乘法数组(就像方法中的矩阵乘法一样)。似乎它在运行时被卡在无限循环中的某个地方。任何修改?
public static void multiplicationOfArray(int[][] matrix1, int[][] matrix2) {
int row1 = matrix1.length;
int column1 = matrix1[0].length;
int row2 = matrix2.length;
int column2 = matrix2[0].length;
int[][] resultmatrix = new int[row1][column2];
if (column1 == row2) {
for (int i = 0; i < row1; row1++) {
for(int j = 0; j < column2; j++) {
for (int k = 0; k < column1; k++) {
resultmatrix[i][j] += matrix1[i][k] * matrix2[k][j];
}
}
}
for (int row = 0; row < row1; row++) {
for (int column = 0; column < column2; column++) {
System.out.println(resultmatrix[row][column] + " ");
}
System.out.println();
}
}
}