title: How to get time of Fibonacci recursion
body: <p>I have an task, they give to me an recursion fibonacci algoritm and ask to return a time. I done it with .SystemCurrentMilis and i post my code below, but the testers said that its takes to long to count time, so i think i must give them some teoretic time, because execute function and get time is too long. Hope on yours help guys. How to make function timetocompute work faster on whatever n coming.</p>
  
  <pre><code>import java.math.BigInteger;
  import java.math.BigDecimal;
  
  public class Fibonacci {
  
  public BigDecimal timeToComputeRecursiveFibonacci(int n) {
      long startTime = System.currentTimeMillis();
      recursive(n);
      long finishTime = System.currentTimeMillis();
      long tempTime = finishTime - startTime;
      BigDecimal usedTime = BigDecimal.valueOf(tempTime);
      return usedTime;
  }
  
  
  public BigInteger recursive(int n) { 
      if (n &lt;= 1)
          return BigInteger.valueOf(n);
      return recursive(n - 1).add(recursive(n - 2));
  }
  </code></pre>
  
  <p>}    </p>