title: Combinations using memoization in java
body: <p>I'm making a program that calculates a combination given two numbers, ex:</p>
  
  <pre><code>java Combination 5 3 
  </code></pre>
  
  <p>would give an answer of 10.</p>
  
  <p>I have a method that looks like this:</p>
  
  <pre><code>public static int choose(int n, int k) {   // chooses k elements out of n total
    if (n == 0 &amp;&amp; k &gt; 0)
        return 0;
    else if (k == 0 &amp;&amp; n &gt;= 0)
        return 1;
    else return choose(n - 1, k - 1) + choose(n - 1, k);
  </code></pre>
  
  <p>How would I be able to use memoization for this in order to make it calculate faster with larger numbers?</p>