package com.heima;
public class ClassTest {
public static void main(String[] args) {
int[] a = new int[100];
for (int i = 0; i < a.length; i++) {
a[i] = i;
}
int original = 0;
while (a.length >= 14) {
int t = 0;
for (int i = original; i < a.length + original; i++) {
if (i % 14 == 13) {
a[i - original] = -1;
t++;
}
}
original = (a.length + original) % 14;
int[] a1 = new int[a.length - t];
for (int i = 0, k = 0; i < a.length; i++) {
if (a[i] == -1) {
continue;
}
a1[k++] = a[i];
}
a = a1;
}
for (int i = 0; i < a.length; i++) {
System.out.println(a[i] + " ");
}
}
}
|