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 num) {
return IntStream.range(2, (num/2 +1)).noneMatch(divider -> (num % divider) == 0);- return IntStream.range(2, (num/2 +1)).noneMatch(divider -> (num % divider) == 0);
- }
- }