(int i)
| 4 | public static int max = 100; // Make this as big as you want! (Though you'll exceed the bounds of a long around 46) |
| 5 | public static int[] fib = new int[max]; |
| 6 | public static int fibonacci(int i) { |
| 7 | if (i == 0) { |
| 8 | return 0; |
| 9 | } |
| 10 | if (i == 1) { |
| 11 | return 1; |
| 12 | } |
| 13 | if (fib[i] != 0) { |
| 14 | return fib[i]; |
| 15 | } |
| 16 | fib[i] = fibonacci(i - 1) + fibonacci(i - 2); |
| 17 | return fib[i]; |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * @param args |