Sieve of Eratosthenes and twin prime finder
Implementation

// Mark multiples of each prime as non-prime
for (int i = 2; i&lt;max; i++) {
    if (arePrimes[i]) {
        for (int m = 2; i * m &lt; max; m++) {
            arePrimes[i*m] = false;
        }
    }
}


Pretty close to the perfect implementation.

However...

Consider the Transitive relation of the multiplication operation: 5 times 2 is 10. 2 times 5 is 10. It doesn't matter in which order you multiply things.

So when you multiply, say, 3 by 2, you're just multiplying 2 by 3 again. And the same goes for 5 by 2, 7 by 2, 11 by 2... but also 5 by 3, 7 by 3, 7 by 5, etc.

What you'd do in this case is start m off at the value of i. This solves the issue where you're multiplying 2 with 3 and 3 with 2, thus checking the same thing twice.

There's another issue: Now that we're effectively checking (i * i) &lt; max in the inner loop on the first iteration, it doesn't make sense for the outer loop to check for on i &lt; max. Instead, you'd want to check for (i * i) &lt; max there as well.

// Mark multiples of each prime as non-prime
for (int i = 2; i * i &lt; max; i++) {
    if (arePrimes[i]) {
        for (int m = i; i * m &lt; max; m++) {
            arePrimes[i*m] = false;
        }
    }
}




I was also a bit worried about getMax willing to accept negative numbers, but Java will throw a java.lang.NegativeArraySizeException, and as such, the error should be pretty clear. For use in a larger application, you might want to handle the exception, rather than the program forcibly exiting.

Documentation

You should use Javadoc style comments. Simple //comments before each function generally don't get picked up by IDE's. By making use of Javadoc, you can provide descriptions of what a method does and what the meaning of each parameter is. Like that, not only will other programmers easily be able to search for information in a method's documentation, it can also be automated - like an IDE showing a tooltip for each method parameter as you type them.