code: @SuppressWarnings("unchecked")
      private Hashtable<String, Object> getEnvironment(int type, String startingURL) {
          Hashtable<String, Object> env = new Hashtable<String, Object>(iEnvironment);
          List<String> urlList = (List<String>) env.remove(ENVKEY_URL_LIST);
          int numURLs = urlList.size();
  
          // get active URL index
          int startingURLIndex = getURLIndex(startingURL, urlList);
  
          // generate the sequence
          String ldapUrl = null;
          for (int i = startingURLIndex; i < startingURLIndex + numURLs; i++) {
              if (i > startingURLIndex)
                  ldapUrl = ldapUrl + " " + urlList.get(i % numURLs);
              else
                  ldapUrl = urlList.get(i % numURLs);
  
              if (type == URLTYPE_SINGLE)
                  break;
          }
  
          env.put(Context.PROVIDER_URL, ldapUrl);
          env.remove(ENVKEY_ACTIVE_URL);
  
          return env;
      }
docs: Returns LDAP environment containing specified URL sequence.
  
  @param type Single or sequence
  @param startingURL Starting URL
  @return Environment containing specified URL sequence