Hi dr_victoria

ive made some ground with the prime directive challenge (making a prime number list from an array of numbers putting them into a new ArrayList) , ive gotten down to it making a new ArrayList of primes, how ever it seems it has eliminated the non prime numbers except the number 33, i used a if then statement to eliminate this: else if (number % 3 == 0) { return false; } but im still seeing 33 when i print out the ArrayList, ill attach my code maybe you you’ll have some suggestions

on my isPrime method i was returning like this: return true && false; //but since i figured i only need true i took away false leaving only: return true; //but it seemed didnt make any difference as i think if then else statements will only execute on code that is true

when i run my code i get the result of: {29, 33, 11, 101, 43, 89}

heres my code

appreciate any feed back

import java.util.ArrayList;

class PrimeDirective {

// Add your methods here:

public boolean isPrime(int number){

if (number == 2){

return true;

} else if (number < 2){

return false;

}

for (int i = 2; i < number; i++){

if (number % i == 0) {

return false;

} else if (number % 3 == 0) {

return false;

}

}

return true;

}

//new method for making list of primes

public ArrayList onlyPrimes(int numbers){

Arraylist primes = new ArrayList()

for (number : numbers) {

```
isPrime(number)
primes.add(number)
```

return primes;

}

}

public static void main(String args) {

```
PrimeDirective pd = new PrimeDirective();
int[] numbers = {6, 29, 28, 33, 11, 100, 101, 43, 89};
```

System.out.println(pd.onlyPrimes(numbers));

}

}