this code do the stuff.
any length matrix in 2 dimension
public static int[][] multiplicate(int[][] a, int[][] b)
{
// Matrix a has m rows, and n cols
// Matrix b has n rows, and p cols
int m = a.length;
int n = ((int[])a[0]).length;
int p = ((int[])b[0]).length;
int[][] result = new int[m][p];
for (int i = 0; i < m; i++)
{
for (int j = 0; j < p; j++)
{
int partial = 0;
for (int h = 0; h < n; h++)
{
partial += a[i][h] * b[h][j];
}
res[i][j] = partial;
}
}
return result;
}