So I’ve been working on the prime directive, and even though there are no errors my code isn’t recognizing which are primes. It thinks almost everything is a prime,

https://www.codecademy.com/courses/learn-java/projects/java-prime-directive

import java.util.ArrayList;

class PrimeDirective {

int i;

boolean num;

int number;

// Add your methods here:

public boolean isPrime(int number) {

```
if (number == 2) {
num = true;
}
else if (number < 2) {
num = false;
}
for (i = 2; i < number; i++) {
if (number % i == 0) {
num = false;
}
else {
num = true;
}
}
return num;
}
public ArrayList<Integer> onlyPrimes(int[] numbers) {
ArrayList<Integer> primes = new ArrayList<Integer>();
for (int number : numbers) {
if (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.isPrime(6));
System.out.println(pd.onlyPrimes(numbers));
}
```

}

This prints: true, and numbers

Note: I had to made the num a boolean value and return num because my system was not recognizing my return statements. Maybe the problems are related?