title: Java * Two-Dimensional Array * Plotting Points on Array
body: <p>I have an assignment for a JAVA class I am taking. We are discussing two-dimensional arrays, however on this particular assignment, I can not figure out how to return back specific points and set those points with a specific value. Here is the assignment:</p>
  
  <p>Write a method called create2DArray that will fill, create, and return a 10 x 10 2d array with random numbers in the range of 1 to 100. Write a method called print2DArray that will print a 10 x 10 2D array in row column fashion. Write a method called createCoords that will search the 2D array looking for any value that is evenly divisible by 3. Once you have found a number you should log the row, column location. This means when your method finishes it should produce a list of coordinates that I can use to plot my graph. This method must also return the number of coordinates that are divisible by 3 so that I know how many points there are to plot. I am not particular as to how the coordinates are returned back as long as I get a list of the row, column locations. So, I will leave it to you to work out a mechanism for returning the values. To test that you have logged the coordinates create another function called fillLocations that will fill the locations in the array you have logged with -1. So, your program should flow in this order 1.create2DArray 2.print2DArray 3.createCoords 4.fillLocations 5.print2DArray</p>
  
  <p>I understand and have completed create2DArray and print2DArray, but I can not figure out createCoords and fillLocations. Here is what I have so far, but it does not work and there are errors present:</p>
  
  <pre><code>public int createCoords(int row1, int col1){
  int[][] coords = new int[row1][col1];  
  int[][] count = new int[0][0];
  int co = 0;
  for(int row = 0; row &lt; 10; row++)
  {
      for(int col = 0; col &lt; 10; col++)
      { 
      if(coords[row][col] % 3 == 0)
          co++;
          return count[row][col];
      }
  }
  return co;}
  public int fillLocations(int[][] count){
  int x = 0;
  int y = 0;
  for(int row = 0; row &lt; 10; row++)
  {
      for(int col = 0; col &lt; 10; col++)
      {
      if(count[row][col] % 3 == 0)
          x = row;
          y = col;
          break;
      }
  }
  return (x, y);}
  </code></pre>