public class Fibonacci3 { static int numCalls; public static void main (String[] argv) { // Test case 1: int n = 5; numCalls = 0; int f = fibonacci (n); System.out.println ("f(" + n + ") = " + f + " numCalls=" + numCalls); // Test case 2: n = 20; numCalls = 0; f = fibonacci (n); System.out.println ("f(" + n + ") = " + f + " numCalls=" + numCalls); } static int fibonacci (int n) { // We are recording the number of times this method is called. numCalls ++; if (n <= 2) { return (n-1); } return ( fibonacci(n-1) + fibonacci(n-2) ); } }