List<Integer> test = new ArrayList<Integer>();
for (int i = 1; i <= 81; i++) {
test.add(i);
}
int count = 0;
if (test.size() % 10 == 0) {
for (int i = 0; i <= test.size(); i++) {
count++;
if (count % 10 == 0) {
List<Integer> sub = test.subList(0, count);
for (Integer j : sub) {
System.out.print(j + "j ");
}
count = 0;
sub.removeAll(sub);
i = 0;//这个地方一定要置0,因为removeAll()后原有的list又从0开始索引
}
}
} else {
for (int i = 0; i <= test.size(); i++) {
count++;
if (count % 10 == 0) {
List<Integer> sub = test.subList(0, count);
for (Integer m : sub) {
System.out.print(m + "m ");
}
count = 0;
sub.removeAll(sub);
i = 0;
}
}
System.out.println("");
for (Integer q : test) {
System.out.println(q + "q");
}
}