code: public static String[] getHostsToPowerOfTwo(String[] numberOfHosts) {
          int definedHosts = numberOfHosts.length;
          int numOfHosts = Util.ceilingNextPowerOfTwo(definedHosts);
  
          Set<String> newHosts = new HashSet<String>(numOfHosts);
          if(definedHosts < numOfHosts) {
              for(int i =0;i < numOfHosts;i++) {
                  newHosts.add(numberOfHosts[i%definedHosts]);
              }
          } else {
              return numberOfHosts;
          }
          return newHosts.toArray(new String[newHosts.size()]);
      }
docs: Given an array of host names, makes the host list into a array that has
  a power of two length.  It does this by reusing existing strings to form the
  new string.
  
  for example.  Given : String[] { "localhost:9999","localhost:8888","localhost:8080"}
  The resulting array is : String[] { "localhost:9999","localhost:8888","localhost:8080","localhost:9999"}
  
  for example.  Given : String[] { "localhost:9999","localhost:8888","localhost:8080","localhost:80","localhost:9200"}
  
  The resulting array is : String[] { "localhost:9999","localhost:8888","localhost:8080","localhost:80",
  "localhost:9200","localhost:9999","localhost:8888","localhost:8080",}
  
  @param numberOfHosts
  @return