i cant crack this code
my task is to use a loop,, i need the loop to go till 77777
the problem is that the numbers need to be octagon type.. 1-8 instead of 1-10. i have no idea how to make that conversion. i created 2 loops...
i tried to come up with a code for 2 hours. but no luck
public static void main(String args)
use <= 077777 in the loop condition
and the toString(int, int) method of Integer, with the radix being 8.
IOW, hardcoded integers that begin with 0 are assumed to be octal by the compiler (which is what you want so simply precede 77777 with a 0 as shown above). Then you also want to print the values in octal representation, so you need to use a radix of 8 in the static toString method (along with the integer to display). For the rest of the code a simple ++ works (in fact, you can easily change the while to a for that contains nothing but the println with the toString method).
Edit: Of course, it is also easily doable as a one line while loop, too.
Continues to cross-post after being warned. 3 day ban.
Temporary ban after warned... Let see.
Originally Posted by Fubarable