Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class playground
- {
- private int i = 0;
- private String Output;
- public static void main(String[] args) {
- i = args[0].parseInt() ;
- iterative(i, Output);
- }
- public void iterative(int rest, String Ausgabe)
- {
- while{rest != 0}
- {
- if (rest%2 == 0)
- {
- Ausgabe.append(0);
- rest = rest/2;
- iterative(rest, Ausgabe);
- }
- else
- {
- Ausgabe.append(1);
- rest = rest/2;
- iterative(rest, Ausgabe);
- }
- }
- else
- {
- print Ausgabe;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement