Hi.. I am really new to java and needed help with these codes..:

-------------------------------
public class LightOut
{ private static final int NLIGHTS = 5;
private static int line = 0;
public static void main(String[] args)
{ remove(NLIGHTS);
}
private static void remove(int n)
{ if (n>0)
{ remove(n-2);
printOut(n,"off");
replace(n-2);
remove(n-1);

}
}
private static void replace(int n)
{ if (n>0)
{ replace(n-1);
remove(n-2);
printOut(n, "on ");
replace(n-2);

}
}
private static void printOut(int n, String s)
{ System.out.printf("%3d %s", n, s);
line++;
if (line%10 == 0)
System.out.printf("%n");
}
}
-------------------------------

apparently, i can't seems to figure out how the codes move.. as in, after the main calls for the method remove(NLIGHTS), and then it falls into the recursion of method remove till it prints 1 off, it will call for method replace(n-2). the thing that i tried, but failed , to understand is, what will be the n that goes into the replace method that is being called from the remove method. as well as, after going into the replace method, and it recurs, and throws back to the remove method, it will start from the start of the method or continues from where it stop.. and what will the n be ?
i am really confused about the movements as well as the new n.

is this also using recursive backtracking?

sorry if this if i am confusing you... am i?? please help me out if you can...
would really appreciate your help

-tea-