posted 8 years ago
Welcome to the Ranch.
You probably know that array indices start counting from zero. Looking to your code, you start filling an array from position 2 (at best), which is the 3rd element in an array - probably it isn't what you want.
You correctly identified that you need a method which defines if number is a prime one. Is that method correct? Have you tested, verified that?
Going back to the loop within the main method, in order to fill in an array fully, you need to iterate over each its element position, that means starting from index 0 each time increasing it by 1, until condition 'index < primes.length' fails.