/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package testmutlchat;
/**
*
* @author Administrator
*/
public class ComputeMatrix {
public static void main(String[] agrs){
int[][] a = {{12,15,8,9},{9,5,87,6}};
int[][] b = {{6,5},{12,78},{36,8},{34,7}};
int[][] c = new ComputeMatrix().getResult(a, b);
for(int i=0;i<c.length;i++){
for(int j=0;j<c[c.length-1].length;j++){
System.out.print(c[i][j]+" ");
if(j==c[c.length-1].length-1){
System.out.println(" ");
}
}
}
}
public int[][] getResult(int[][] a,int[][] b){
int ai=0,aj=0,bi=0,bj=0;
ai = a.length;aj=a[ai-1].length;
bi=b.length;bj=b[bi-1].length;
int[][] d = new int[ai][bj];
for(int i=0;i<ai;i++){
for(int j=0;j<bj;j++){
for(int idx=0;idx<aj;idx++){
d[i][j]+=a[i][idx]*b[idx][j];
}
}
}
return d;
}
}