title: Fibonacci Recursion not working for Java
body: <p>Please forgive my ignorance, I'm still a noob. Whenever I input a moderately big number it does not give me any output because it is stuck in the fibCalculate method. An example of a number that does not give any output would be 40.</p>
  
  <pre><code>package fib;
  
  import java.math.BigInteger;
  import java.util.Scanner;
  
  
  public class FibonacciCalculator {
      private static BigInteger TWO = BigInteger.valueOf(2);
  
      public static BigInteger fibCalculate(BigInteger num) {
          if (num.equals(BigInteger.ONE) || num.equals(BigInteger.ZERO)) {
              return num;
          } else {
              return (fibCalculate(num.subtract(BigInteger.ONE)).add(fibCalculate(num.subtract(TWO))));
          }
      }
  
      public static void main(String[] args) {
          @SuppressWarnings("resource")
          Scanner input = new Scanner(System.in);
          long n = 10;
  
          System.out.println(
                  "Please input a fibonacci placeholder to see what fibonacci number it holds,\nor input 0 to end program. (The count starts at 0):  ");
          n = input.nextLong();
          System.out.println("Answer: "+fibCalculate(BigInteger.valueOf(n)));
  
      }
  }
  </code></pre>