// /*
// * 基础练习 01字串
// *
// * 问题描述
// * 对于长度为5位的一个01串,每一位都可能是0或1,一共有32种可能。它们的前几个是:
// * 00000
// * 00001
// * 00010
// * 00011
// * 00100
// * 请按从小到大的顺序输出这32种01串。
// * 输入格式
// * 本试题没有输入。
// * 输出格式
// * 输出32行,按从小到大的顺序每行一个长度为5的01串。
// *
// * 样例输出
// * 00000
// * 00001
// * 00010
// * 00011
// * <以下部分省略>
// * */
private static void BASIC_2() {
int a[] = new int[5];
int temp;
for (int i = 0; i < 32; i++) {
// System.out.println(Integer.toBinaryString(i));
temp = i;
a[0] = temp / 16;
temp = temp % 16;
a[1] = temp / 8;
temp = temp % 8;
a[2] = temp / 4;
temp = temp % 4;
a[3] = temp / 2;
temp = temp % 2;
a[4] = temp / 1;
for (int j = 0; j < a.length; j++) {
System.out.print(a[j]);
}
System.out.println();
}
}