String id; Random rand = new Random(); boolean ok; do { ok = true; id = Integer.toHexString( rand.nextInt() ) + ".xml";  for ( int i = 0; i < resources.size(); i++ ) if ( ( (String) resources.get( i ) ).equals( id ) ) ok = false;
if (childCollections == null) readCollection(); String id; Random rand = new Random(); boolean ok; do { ok = true; id = Integer.toHexString(rand.nextInt()) + ".xml";  for (int i = 0; i < resources.size(); i++) if (((String) resources.get(i)).equals(id)) ok = false;
    public String createId() throws XMLDBException {        String id;        Random rand = new Random();        boolean ok;        do {            ok = true;            id = Integer.toHexString( rand.nextInt() ) + ".xml";            // check if this id does already exist            for ( int i = 0; i < resources.size(); i++ )                if ( ( (String) resources.get( i ) ).equals( id ) )                    ok = false;            if ( childCollections.containsKey( id ) )                ok = false;        } while ( !ok )            ;        return id;    }