[Solved] Printing Boolean Array in Java [closed]


It looks like you do not want to print boolean array: it’s of little use. You need to print the primes from the Sieve of Eratosthenes, which can be done by enumerating the indexes, checking if primes[i] is true, and printing the index if it is.

boolean primes = sieve(100);
for (int i = 0 ; i <= 100 ; i++) {
    if (primes[i]) {
        // This is where you print i or do whatever else you think is appropriate
    }
}

solved Printing Boolean Array in Java [closed]