int rows = 5;
int cols = 10;
int[] multD = new int[rows * cols];
for (int r = 0; r < rows; r++)
{
for (int c = 0; c < cols; c++)
{
int index = r * cols + c;
multD[index] = index * 2;
}
}
int [][] twoDim = new int [5][5];
int a = (twoDim.length);//5
int b = (twoDim[0].length);//5
for(int i = 0; i < a; i++){ // 1 2 3 4 5
for(int j = 0; j <b; j++) { // 1 2 3 4 5
int x = (i+1)*(j+1);
twoDim[i][j] = x;
if (x<10) {
System.out.print(" " + x + " ");
} else {
System.out.print(x + " ");
}
}//end of for J
System.out.println();
}//end of for i
First Second Third
Fourth Fifth Sixth
Seventh Eighth Ninth
Tenth Eleventh Twelfth
First Second Third added0
Fourth Fifth Sixth added1
Seventh Eighth Ninth added2
Tenth Eleventh Twelfth added3
First Second Third added0
Fourth Fifth Sixth added1
Tenth Eleventh Twelfth added3