I have a method that prints out binary formar of numbers:
private static void binary(int n){
for(int i = 1; i < Math.pow(2, n); i++)
System.out.println(Integer.toBinaryString(i));
}
}
Output is like for n = 3:
1
10
11
100
101
110
111
Is there a way to print out like this:
001
010
011
100
101
110
111