For the following method, when mystery(45) is called, the output is "1 0 1 1 0 : 2 5 11 22 45". I understand why "1 0 1 1 0 :" is printed out, but don't understand how "2 5 11 22 45" is printed out after the colon. Can someone explain this to me? I've tried writing it out, but I just could not figure it out.
public static void mystery (int n) {
if (n <= 1) {
System.out.print(": ");}
else {
System.out.print((n % 2) + " ");
mystery (n/2);
System.out.print(n + " ");
}
}