1 public class Fibonacci{ 2 3 4 public long fibonacci(int k) { 5 if (int k <= 0) { 6 return 0; 7 } 8 long[] array = new long[k + 1]; 9 array[1] = 1;10 for (i = 2, i <= k, i++){11 array[i] = fibonacci(i - 2) + fibonacci(i - 1); 12 }13 return array[k];14 }15 }