Last active
November 20, 2017 08:53
-
-
Save penut85420/a301951d561fe18685c7e3cb5dc2d38e to your computer and use it in GitHub Desktop.
Splite num sequence
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.Test; | |
public class Num123 { | |
public static void main(String[] args) { | |
int n = 5; | |
foo(2, n, "1"); | |
} | |
public static void foo(Integer i, Integer n, String s) { | |
if (i == n) { | |
log(s + " " + i.toString() + "\n"); | |
log(s + i.toString() + "\n"); | |
return ; | |
} | |
foo(i + 1, n, s + " " + i); | |
foo(i + 1, n, s + i.toString()); | |
} | |
public static void log(Object obj) { | |
System.out.print(obj.toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment