I have a TreeSet, which will be full of integers. To make a long story short, I'm trying to loop starting after the last (greatest) value stored in the list. What I'm doing now to get the starting variable is:
Object lastObj = primes.last();
Integer last = new Integer(lastObj.toString());
int start = 1 + last.intValue(); // the added 1 is just for program logic
I'm sure that there must be a better way to cast an object (which I know will always be an int) into the int 'start'. Anyone know of a better way of doing this?