title: Comparing elements in row and columns, in this case 1 and 0
body: <p>I've created a 2 dimensional array with the same length and it is randomly filled with 1 and 0 for example.</p>
  
  <pre><code>0100
  0010
  1110
  1111
  </code></pre>
  
  <p>How do I code the program to find the <strong>rows</strong>,<strong>columns</strong> and <strong>diagonals</strong> with all 1s and 0s</p>
  
  <p>This is my code so far:</p>
  
  <pre><code>public class Test2dArray {
      public static void main(String[] args) {        
          int row,column;
          System.out.print("Enter the lenghth of matrix:");
          Scanner input = new Scanner(System.in);
          Random rand = new Random ();
          int mSize = input.nextInt();
          int [][] mArray = new int [mSize][mSize];
  
          for (row=0; row &lt; mSize; row++){
              for(column=0; column &lt; mSize; column++){                
                  mArray[row][column]=rand.nextInt(2);
                  System.out.print(mArray[row][column]+ " ");
              }
              System.out.println();
          }
      }
  }
  </code></pre>