Prime number generation algorithm
Answer by janos is good, but is more about style. Here are some functional/performance observations related to your stated goal of efficiency.


invalidated.add(Math.round(f + 0.0)), huh???
f coerced to double, add a zero, call round(). Why?
Suggest change f from int to long, and just use invalidated.add(f).
while(f &lt;= maxFac){ is done by continually coercing f to double and comparing the double values. Change maxFac to long using cast (truncation is ok here, no need for rounding).
for(long l : invalidated){ primes.add(l); } is a long way of saying primes.addAll(invalidated), except you're adding the overhead of unboxing and reboxing the values.
You have two identical loops of invalidated to determine if prime. Move to reusable method (DRY).
Never do String += String in a loop. Use a StringBuilder.
And again, what's with the i + 0.0?

StringBuilder buf = new StringBuilder();
buf.append(Math.round(i * 100.0 / max)).append("%: ");
for (Long prime : primes)
    buf.append(prime).append('/');
System.out.println(buf);