Sum of First N Primes
If you want a combination of readability and performance, consider the following solution.

public class Primes {
    private final boolean[] isComposite;
    private int n = 2;

    public Primes(int sieveSize) {
        this.isComposite = new boolean[sieveSize];
    }

    public static int overestimateOfNthPrime(int n) {
        // http://en.wikipedia.org/wiki/Prime_number_theorem#Approximations_for_the_nth_prime_number
        return (int)(1.5 * n * Math.log(n));
    }

    public int next() {
        try {
            return n;
        } finally {
            // Sieve of Eratosthenes: mark multiples of n as composite
            for (int i = 2 * n; 0 &lt;= i &amp;&amp; i &lt; this.isComposite.length; i += n) {
                this.isComposite[i] = true;
            }
            do {
               n++;     // TODO: check array bounds
            } while (this.isComposite[n]);
        }
    }

    public static long sumFirstPrimes(int n) {
        Primes primes = new Primes(overestimateOfNthPrime(n));
        long sum = 0;
        while (n-- &gt; 0) {
            sum += primes.next();
        }
        return sum;
    }

    public static void main(String[] args) {
        long start = System.nanoTime();
        System.out.println(sumFirstPrimes(Integer.parseInt(args[0])));
        System.err.println(System.nanoTime() - start);
    }
}


If your concern is "people first", then I think this is an improvement.  The sumFirstPrimes() function is more readable because the code that discovers more primes is decoupled from the code that sums them.  There are no magic numbers like 5 and 6, and no weird special cases.  Note that the readability comes mainly from the code structure, not from the comments on the code.

If your concern is performance, then the Sieve of Eratosthenes is a better algorithm for discovering many prime numbers.  It doesn't matter how many ugly hacks you use to optimize your trial division method — the Sieve simply scales better (up to a point).

$$\begin{array}{r|r|r}
\textrm{First } n \textrm{ primes} &amp; \textrm{Legato's trial division} &amp; \textrm{200_success's sieve} \\
\hline
10^3 &amp;         ~1000\ \mathrm{\mu s} &amp; ~2000\ \mathrm{\mu s} \\
10^4 &amp;           ~10\ \mathrm{ms}    &amp;   ~10\ \mathrm{ms}    \\
10^5 &amp;          ~125\ \mathrm{ms}    &amp;   ~40\ \mathrm{ms}    \\
10^6 &amp;         ~4000\ \mathrm{ms}    &amp;  ~500\ \mathrm{ms}    \\
10^7 &amp; \color{gray}{\textit{DNF}}    &amp;    ~7\ \mathrm{s}     \\
\end{array}$$

In the interest of full disclosure…


Making the estimate of the nth prime takes some mathematical knowledge.
I trust the estimate, so I didn't bother to check the array bounds.
For truly large problems (e.g 108), memory management for the Sieve would be a chore.