I've just written this piece but for some reason in the console I get some numbers which look right but are in the wrong order, and some numbers are repeated. What is the problem?
public class Fibonacci {
public static void main(String[] args) {
int n = 5;
fibonacci(n);
}
public static int fibonacci(int n) {
if(n == 0) {
System.out.println(0);
return 0;
} else if(n == 1) {
System.out.println(1);
return 1;
} else {
int result = fibonacci(n - 1) + fibonacci(n - 2);
System.out.println(result);
return result;
}
}
}

n=0, results for testn=1..." etc?