the output is supposed to be like this:
1 0 0 1
0 1 1 0
0 1 1 0
1 0 0 1
what I have is this:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
import java.util.*;
class Array{
public static void main(String args[]){
int[][] M;
M = new int[4][4];
for(int row=0; row<4; row++){
for(int col=0; col<4; col++){
if(row==col)
M[row][col] = 1;
else
M[row][col] = 0;
}
}
for(int row=0; row<4; row++){
System.out.println();
for(int col=0; col<4; col++){
System.out.print(" "+M[row][col]);
}
}
}
}