title: Java 2d array negative number program
body: <p>this is what I am supposed to do:</p>
  
  <p>"Write a code segment that searches a two-dimensional array for a negative integer. The loop should terminate at the first instance of a negative integer in the array, and the variables row and col should be set to its position. Otherwise, if there are no negative integers in the array, the variables row and col should equal the number of rows and columns in the array (we assume that each row has the same number of columns)."</p>
  
  <p>So far this is what I have:</p>
  
  <pre><code>int[][] newArray = {{1, 2, 4, -7, 1}, {6, 4, -5, 2, 1}};
  
  for(int row = 0; row &lt; newArray.length; row++){
  for (int col = 0; col &lt; newArray[row].length; col++){
  if (newArray[row][col] &lt; 0){
  //Number is negative
  
  }
  }
  } 
  </code></pre>