Hits/True | False | Line | Source |
---|---|---|---|
1 | public class Calc | ||
2 | { | ||
3 | |||
Top | |||
9 | 4 | public static boolean isPrime(int value) | |
5 | { | ||
6 | int divisor; | ||
7 | |||
2 | 7 | 8 | if (value == 1 || value == 2 || value == 3) |
1 | 8 | 1: T || _ || _ | |
0 | 8 | 2: F || T || _ | |
1 | 8 | 3: F || F || T | |
7 | 8 | 4: F || F || F | |
2 | 9 | return true; | |
10 | |||
5 | 2 | 11 | if (value % 2 == 0) |
5 | 12 | return false; | |
58 | 2 | 13 | for (divisor = 3; divisor < value / 2; divisor += 2) |
14 | { | ||
0 | 58 | 15 | if (value % divisor == 0) |
0 | 16 | return false; | |
17 | } | ||
2 | 18 | return true; | |
19 | } | ||
20 | |||
21 | } | ||
22 |