What did I do wrong with this code? I thought it compiled great.
import java.util.Scanner; public class mycode_Sieve { private boolean primes[] = new boolean [50001]; private int upper = 50000; private int lower = 1; public void processSieve() { primes[0] = false; primes[1] = false; for (int a = 2; a < 50000; a++) { primes[a] = true; } for (int a = 2; a <= 223; a++) { if (primes[a]) { for (int b = a; b <= 223; b++) { int c = (a * b); primes[c] = false; } } } } public void getBoundaries() { System.out.println ("Please enter a lower boundary and an upper boundary and I will print sexy prime pairs between those boundaries."); Scanner i = new Scanner (System.in); System.out.print("Please enter the lower boundary (between 1 and 50000): "); lower = i.nextInt(); while ((lower <= 0) || (lower > 50000)) { System.out.print("Please enter the lower boundary (between 1 and 50000): "); lower = i.nextInt(); } System.out.print("Please enter the upper boundary (between 1 and 50000): "); upper = i.nextInt(); while ((upper <= 0) || (upper > 50000)) { System.out.print("Please enter the upper boundary (between 1 and 50000): "); upper = i.nextInt(); } while (lower > upper) { System.out.println ("Your upper boundary cannot be smaller than your lower boundary."); System.out.print("Please enter the lower boundary (between 1 and 50000): "); lower = i.nextInt(); while ((lower <= 0) || (lower > 50000)) System.out.print("Please enter the lower boundary (between 1 and 50000): "); lower = i.nextInt(); } System.out.print("Please enter the upper boundary (between 1 and 50000): "); upper = i.nextInt(); while ((upper <= 0) || (upper > 50000)) { System.out.print("Please enter the upper boundary (between 1 and 50000): "); upper = i.nextInt(); } } } public void showPrimes() { System.out.printf("Here are all of the sexy prime pairs in the range %d to %d, one pair per line:\n", lower, upper); int counter = 0; for (int a = lower; a <= upper; a++) { if (primes[a] == true) { int b = (a + 6); if (b <= 50000) { if (primes[b] == true) { System.out.printf("%d and %d\n", a, b); counter++; } } } } System.out.printf("There were %d sexy prime pairs displayed between %d and %d\n", counter, lower, upper); } }