You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//Write a method called sieve that takes an integer parameter, n, and returns a boolean array that indicates, for each number from 0 to n - 1, whether the number is prime.
import java.util.Arrays;
import java.util.Scanner;
public class Sieve {
public static boolean checkPrime(int n) {
boolean bool = true;
if (n < 2) {
bool = false;
} else if (n == 2) {
bool = true;
} else {
for (int i = 2; i <= Math.sqrt(n); i++) {
//the square root is some kind of math principle/property