Java: How do I get the integer (x,y) of a specify coordinate from a 2d double array
<p>I have an array of 2d double data say [100][100]. Most of it is fill with '0.0' while there is a block of '1.0' located somewhere inside. I make a loop and are able to locate the '1.0' but have no idea how to extract the x and y (not the value which is '1.0') from it.</p>

<p>I spent hours searching for a solution. Even tried Arrays.binarySearch method but keep giving me error. Below is my code to loop through the array.</p>

<pre><code>int findX() {
  for (int i = 0; i &lt; data.length; i++) {
    for (int j = 0; j &lt; data[i].length; j++) {
      if (data[i][j] == 1.0) {
        int x = i;
      }
      break; // stop search once I found the first '1.0'
             // as there are a couple of them
    }
  }
  return x;
</code></pre>

<p>Please help, any advice are greatly appreciated. </p>
