title: Recursively compute the value of base to the n power
body: <p>Here is what I have for my solution:</p>
  
  <pre><code> public int powerN(int base, int n) {
  
      if(n == 0)
         return 1;
  
      else if(n % 2 == 0)
         return base * base;
  
      else
         return base * powerN(base, n-1); 
  
   }
  </code></pre>
  
  <p>However, if n > 3 then this function doesn't work.
  For instance, powerN(2, 4) yields 4 and powerN(2, 5) yields 8.
  I know that a much simpler solution exists, but it just bothers me that I can't figure out why this is not working correctly. </p>