public class Solution { public static void main(String[] args) { boolean[] box = new boolean[101]; for(int i = 1; i <= 100; i++) { for(int j = i; j <= 100; j += i) changeBox(box, j); } for(int i = 1; i <= 100; i++) System.out.printf("%d\t%b\n", i, box[i]); } public static void changeBox(boolean[] array, int flag) { if(array[flag] == true) array[flag] = false; else array[flag] = true; } }