Source Code:
public class SparseMatrix {
public static void main(String[] args) {
int[][] a = {
{0, 0, 3},
{0, 0, 0},
{5, 0, 0}
};
int size = 9;
int count = 0;
for(int i=0; i<3; i++) {
for(int j=0; j size / 2) {
System.out.println(“true”);
} else {
System.out.println(“false”);
}
}
}
Output:
