코드
class Main {
public void DFS(int n){
if(n==0) {
System.out.println();
return;
}
else{
DFS(n/2);
System.out.print(n%2);
}
}
public void solution(int n){
DFS(n);
}
public static void main(String[] args){
Main T = new Main();
T.solution(8389017);
T.solution(16678809);
T.solution(16359297);
T.solution(15198105);
T.solution(10484121);
T.solution(16777215);
T.solution(12583161);
System.out.println();
System.out.println(Integer.toBinaryString(16776441));
System.out.println(Integer.toBinaryString(16776441));
System.out.println(Integer.toBinaryString(8388633));
System.out.println(Integer.toBinaryString(16728057));
System.out.println(Integer.toBinaryString(16728057));
System.out.println(Integer.toBinaryString(16728057));
}
}
결과
100000000000000110011001
111111100111111110011001
111110011001111110000001
111001111110011110011001
100111111111100110011001
111111111111111111111111
110000000000000011111001
111111111111110011111001
111111111111110011111001
100000000000000000011001
111111110011111111111001
111111110011111111111001
111111110011111111111001