public static ArrayList<Integer> primeNumbers(int n) {
		if (n < 2)
			return new ArrayList<Integer>();
		isPrime = new boolean[n];
		char[] is_composite = new char[(n - 2 >> 5) + 1];
		final int limit_i = n - 2 >> 1, limit_j = 2 * limit_i + 3;
		ArrayList<Integer> results = new ArrayList<Integer>(
				(int) Math.ceil(1.25506 * n / Math.log(n)));
		results.add(2);
		isPrime[2] = true;
		for (int i = 0; i < limit_i; ++i)
			if ((is_composite[i >> 4] & 1 << (i & 0xF)) == 0) {
				results.add(2 * i + 3);
				isPrime[2 * i + 3] = true;
				for (long j = 4L * i * i + 12L * i + 9; j < limit_j; j += 4 * i + 6)
					is_composite[(int) (j - 3L >> 5)] |= 1 << (j - 3L >> 1 & 0xF);
			}
		return results;
	}