Start/ | End/ | |||
True | False | - | Line | Source |
1 | public class Prime | |||
2 | { | |||
3 | int value; | |||
4 | int divisor; | |||
5 | ||||
9 | 0 | 6 | public Prime(int value) | |
7 | { | |||
8 | this.value = value; | |||
9 | } | |||
10 | ||||
9 | 0 | 11 | public boolean isPrime() | |
12 | { | |||
2 | 7 | 13 | if (this.value == 1 || this.value == 2 || this.value == 3) | |
1 | 13 | T || _ || _ | ||
0 | - | 13 | F || T || _ | |
1 | 13 | F || F || T | ||
7 | 13 | F || F || F | ||
2 | 14 | return true; | ||
15 | ||||
5 | 2 | 16 | if (this.value % 2 == 0) | |
5 | 17 | return false; | ||
58 | 2 | 18 | for (divisor = 3; divisor < this.value / 2; divisor += 2) | |
19 | { | |||
0 | 58 | - | 20 | if (this.value % divisor == 0) |
0 | - | 21 | return false; | |
22 | } | |||
2 | 23 | return true; | ||
24 | } | |||
25 | ||||
26 | } | |||
27 | ||||
***TER 83% (15/18) of SOURCE FILE Prime.java |