Here's the basics of my code. The number I want to display would be i in the first for loop.

public static void main (String args[]) { String answer = ""; List<Integer> primeList = new ArrayList<Integer>(); primeList.add(2); primeList.add(3); primeList.add(5); primeList.add(7); for (int i = 8; i <= 1000000; i++) { if ((Primes.multipleOfThreeCheck(Primes.multipleOfThree(i)) == false) && (Primes.multipleOfFive(i) == false)) { if (Primes.primeFinder (i, (ArrayList)primeList) == true) { primeList.add(i); } } } for (int j = 0; j < primeList.size(); j++) { answer += primeList.get(j) + "\n"; } System.out.println(answer); }