import java.util.stream.IntStream; public class Primes { public static boolean isAPrime(int num) { return IntStream.range(2, (num/2 +1)) .noneMatch(divider -> (num % divider) == 0); } }
- import java.util.stream.IntStream;
- public class Primes {
public static boolean isAPrime(int number) {return IntStream.range(2, (number/2 +1)).noneMatch(divider -> (number % divider) == 0);- public static boolean isAPrime(int num) {
- return IntStream.range(2, (num/2 +1))
- .noneMatch(divider -> (num % divider) == 0);
- }
- }