BAEL-3635 Intro to Alibaba Arthas

Adding a case study to show Arthas.
This commit is contained in:
Antonio Moreno 2020-02-06 22:55:09 +00:00
parent e994174d1f
commit 0b8b9715c6
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
package com.baeldung.arthas;
import java.io.IOException;
import static java.lang.String.format;
public class FibonacciGenerator {
public static void main(String[] args) throws IOException {
System.out.println("Press a key to continue");
System.in.read();
for (int i = 0; i < 100; i++) {
long result = fibonacci(i);
System.out.println(format("fib(%d): %d", i, result));
}
}
public static long fibonacci(int n) {
if (n == 0 || n == 1) {
return 1L;
} else {
return fibonacci(n - 1) + fibonacci(n - 2);
}
}
}