import java.util.Arrays;
public class Lab12st {
public static void main(String args[]) {
System.out.println("/nLab 12 80 Point Version \n");
final int MAX = 100;
boolean primes[];
primes = new boolean[MAX];
computePrimes(primes);
displayPrimes(primes);
}
public static void computePrimes(boolean listA[]) {
Arrays.fill(listA, true);
for (int j = 2; j < 100; j++) {
for (int k = 0; k <= 100; k += j) {
listA[k] = false;
System.out.println(listA[k + 1]);
}
}
}
}
I have tried using different relational operators, switching some numbers around, and I still get an IndexOutofBounds
error. I think it is because I have 100 array elements that are listed 0-99, but I don't know how to fix this. Any help would be greatly appreciated.