title: Java recursive method for summing the powers of 2, from 0 to N
body: <p>so im trying to learn recursion (i know in this case recursion is not necessary)</p>
  
  <p>i have already written this method, which works</p>
  
  <pre><code>public static int method(int number) {
      if(number == 0) {
          return 1;
      }
      else {
          return (int)Math.pow(2,number) + method(number-1);
      }
  }
  </code></pre>
  
  <p>this works perfectly for summing the powers of 2 from 0 to number, but i was wondering if there was a way to replace the <code>Math.pow()</code> with another recursive method call</p>