Matrix pattern generation
<h2><strong>Hello</strong></h2>

<p>I am working on java and I have to generate all the possible patterns(combinations) of M-by-N matrices such that in the same row there should not be more than a single 1, Same column may contain more than a single 1, Taking an example of 3*3 matrix, matrices generated should look like:</p>

<pre><code>1 0 0  
1 0 0  
1 0 0  

0 1 0  
1 0 0  
1 0 0  

0 0 1  
1 0 0  
1 0 0  

1 0 0  
0 1 0  
1 0 0  

1 0 0  
0 0 1  
1 0 0  

1 0 0  
1 0 0  
0 1 0  

1 0 0  
1 0 0  
0 0 1  

0 1 0  
0 1 0  
0 1 0  

1 0 0  
0 1 0  
0 1 0  

0 0 1  
0 1 0  
0 1 0  

0 1 0  
1 0 0  
0 1 0  

0 1 0  
0 0 1  
0 1 0  
</code></pre>

<p>..... and so on.</p>

<p>As I have already said that progrom should be flexible that can generate all such possible patterns for any value of M and N.</p>

<p>Please help me..</p>

<p>Thanks! </p>
