62,614
社区成员
发帖
与我相关
我的任务
分享
ArrayList<int[][]> list = new ArrayList<int[][]>();
for (int i=0; i<512; i++) {
int[][] arr = new int[3][3];
for (int j=0; j<9; j++)
arr[j/3][j%3] = i>>>j&1;
list.add(arr);
}
public static void main(String[] args) {
for (int i = 0; i < 512; i++) {
String str = Integer.toBinaryString(i);
String temp = "000000000";
if(str.length() < temp.length())
str = temp.substring(0, temp.length() - str.length()) + str;
System.out.println(str.substring(0,3));
System.out.println(str.substring(3,6));
System.out.println(str.substring(6,9));
System.out.println("~~~~~~~~~~~~~~");
}
}