-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrimeNumbersList.java
39 lines (33 loc) · 996 Bytes
/
PrimeNumbersList.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.fatorac;
import java.util.ArrayList;
public class PrimeNumbersList {
private ArrayList<Integer> primeNumbersList = new ArrayList<Integer>();
private Integer divisible = 0;
public PrimeNumbersList(){
this.primeNumbersList.add(2);
this.primeNumbersList.add(3);
this.primeNumbersList.add(5);
this.primeNumbersList.add(7);
this.primeNumbersList.add(11);
this.primeNumbersList.add(13);
this.primeNumbersList.add(17);
}
public boolean thereAnyDivisible(Integer number){
for(Integer primeNumber : this.primeNumbersList){
if(number % primeNumber == 0){
return true;
}
}
return false;
}
public void setDivisible(Integer number){
for(Integer primeNumber : this.primeNumbersList){
if(number % primeNumber == 0){
this.divisible = primeNumber;
}
}
}
public Integer getDivisible(){
return this.divisible;
}
}