I have a sorted array, containing a list of all the uid's for all users in an LDAP directory. For various reasons, accounts are terminated, and uid's become free. I need to iterate through the array, and find the next unused sequential uid > 1000. Any help is appreciated.