title: How to print the fibonacci sequence in reverse order WITHOUT using a loop
body: <p>I got this question in an interview. It's easy until the part when the interviewer wants me to not use the loop I used in the print method. number of terms is an input, when it's 7, For example: print 13 8 5 3 2 1 1. He said it's easy in Python but I can write the mechanism in Java too but I can't think of which mechanism he may be referring to. Thank you!</p>
  
  <p>My Java code:</p>
  
  <pre><code>public class Fibonacci {
      private int[] a;
  
      private int fib(int i) {
          assert (i&gt;=0);
  
          if (a[i]==0) {
              if (i==0 || i==1) {
                  a[i] = 1;
              } else {
                  a[i] = fib(i - 2) + fib(i - 1);
              }
          }
  
          return a[i];
      }
  
      public Fibonacci(int numberTerms) {
          if (numberTerms&lt;2) throw new IllegalArgumentException("expect at least 2 terms for a Fibonacci sequence");
          a = new int[numberTerms];
      }
  
      public void print() {
          for (int i=a.length; i!=0; i--) {
              System.out.println(fib(i-1));
          }
      }
  
      public static void main(String[] args) {
          Fibonacci f = new Fibonacci(7);
          f.print();
      }
  }
  </code></pre>