Might not matter here, but boxing penalty. Use the set's iterator directly, and its `nextLong()` method.