title: Fibonacci number is negative
body: <p>I have written the following code using dynamic programming technique but I am getting a negative number when I run Fibonacci for number 220. Is there a mistake in this program?</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  
  public class Fibonaci {
  
      public static void main(String[] args) {
          System.out.println(" number ");
          long startTime = System.currentTimeMillis();
          HashMap&lt;Integer, Integer&gt; memoized = new HashMap&lt;Integer, Integer&gt;();
          int fib = fibonanci(220, memoized);
          System.out.println(" Total Time "
                  + (System.currentTimeMillis() - startTime));
  
      }
  
      private static int fibonanci(int n, HashMap&lt;Integer, Integer&gt; memoized) {
          System.out.println(" n " + n);
          if (memoized.containsKey(n)) {
              return memoized.get(n);
          }
  
          if (n &lt;= 0) {
              return 0;
          }
          if (n &lt;= 2) {
              return 1;
          } else {
              int febonani = fibonanci(n - 1, memoized)
                      + fibonanci(n - 2, memoized);
              System.out.println(" febonani " + febonani);
              if (!memoized.containsKey(n)) {
                  memoized.put(n, febonani);
              }
              return febonani;
          }
      }
  
  
  }
  </code></pre>