BAEL-3635 Intro to Alibaba Arthas
Adding a case study to show Arthas.
This commit is contained in:
parent
e994174d1f
commit
0b8b9715c6
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue