Original Post
This is part of an assignment that I'm pretty sure is supposed to be simple to implement, but I must have brain freeze or something. This method I wrote will convert the int n to a binary decimal and print it out...backwards(whoops!). I can't use local variables, it must be recursive and the method must have this signature. Is there something I'm doing that's obvious and easy to fix so it will print in the correct order?
public static void binaryPrint(int n)
{
if(n > 0)
{
System.out.print((n % 2 ));
binaryPrint(n / 2);
}
}
[Edited by - Tigernado on May 1, 2008 1:13:44 PM]