View Single Post
  #1 (permalink)  
Old 12-14-2007, 12:37 PM
Igor Igor is offline
Member
 
Join Date: Dec 2007
Posts: 2
Igor is on a distinguished road
reference to elements in array
I'm working with a username system that retrieves every ID and sees if there is a name attached to that specific ID. Since the great majority of ID's does not have a name attached to it, it takes quite some unnecessary time. To prevent this, I'd like to try the following:

int [] usedIDs = {1,6,34,69,306,486 etc...};

for (int i = 0; i < usedIDs.length; i++) {
//System.out.println(usedIDs[i]);
}

and then, to from there on handle the IDs that are filled as just an integer.
So something like:

int usedID = usedIDs[1];
int usedID = usedIDs[2];
etc.

Which of course doesn't really work. So I want it to, with increments by one, go through every instance of usedIDs[n] and pass that simple integer on to the rest of the program.
I suspect I need another loop somewhere, but anyone have any concrete ideas on how to fix this?

thanks,
Reply With Quote
Sponsored Links