public static String buildZKQuorumServerString(String[] serverHosts, String clientPort) {
    StringBuilder quorumStringBuilder = new StringBuilder();
    String serverHost;
    InetAddressValidator validator = new InetAddressValidator();
    for (int i = 0; i < serverHosts.length; ++i) {
      if (serverHosts[i].startsWith("[")) {
        int index = serverHosts[i].indexOf("]");
        if (index < 0) {
          throw new IllegalArgumentException(
            serverHosts[i] + " starts with '[' but has no matching ']:'");
        }
        if (index + 2 == serverHosts[i].length()) {
          throw new IllegalArgumentException(serverHosts[i] + " doesn't have a port after colon");
        }
        // check the IPv6 address e.g. [2001:db8::1]
        String serverHostWithoutBracket = serverHosts[i].substring(1, index);
        if (!validator.isValidInet6Address(serverHostWithoutBracket)) {
          throw new IllegalArgumentException(serverHosts[i] + " is not a valid IPv6 address");
        }
        serverHost = serverHosts[i];
        if ((index + 1 == serverHosts[i].length())) {
          serverHost = serverHosts[i] + ":" + clientPort;
        }
      } else {
        if (serverHosts[i].contains(":")) {
          serverHost = serverHosts[i]; // just use the port specified from the input
        } else {
          serverHost = serverHosts[i] + ":" + clientPort;
        }
      }

      if (i > 0) {
        quorumStringBuilder.append(',');
      }
      quorumStringBuilder.append(serverHost);
    }
    return quorumStringBuilder.toString();
  }
Build the ZK quorum server string with "server:clientport" list, separated by ','
@param serverHosts a list of servers for ZK quorum
@param clientPort  the default client port
@return the string for a list of "server:port" separated by ","
hbase-common/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKConfig.java