title: Making a recursive method that labels "organisms"
body: <p>I need to develop a method that can accept a 2D array and will go through the array to check for &quot;organisms&quot; that are defined by an asterisk in the array location. One &quot;organism&quot; is made up of all the asterisks that are neighbors to each other in the up/down and left/right directions, but not the diagonals. My professor recommends that I create 2 methods, one that returns the number of organisms as well as calls the other method that is supposed to be a recursive method that labels the &quot;organisms&quot;. I have started a setup for the first method (below) and have made it so it can accept arrays of length 0 and 1, but I am unsure as to how I setup the rest of the 1st method, 2nd recursive method as well as how I should call it.</p>
  <pre class="lang-java prettyprint-override"><code>public static int howManyOrganisms(char[][] image) {
      int organismCount = 0;
      for (int row = 0; row &lt; image.length; row++) {
          for (int col = 0; col &lt; image[row].length; col++) {
              if (image.length == 0) {
                  return organismCount;
              } else if (image.length == 1 &amp;&amp; image[row].length == 1) {
                  if (image[row][col] == '*') {
                      organismCount += 1;
                      return organismCount;
                  } else {
                      return organismCount;
                  }
              } else {
                  return 0;
              }
          }
      }
      return organismCount;
  }
  </code></pre>