src/main/java/me/codeboy/common/base/net/util/CBParam.java
public static String paramsToString(String charset, String... params) {
        StringBuffer sb = new StringBuffer();
        try {
            for (int i = 0; i < params.length - 1; i = i + 1) {
                sb.append("&");
                sb.append(URLEncoder.encode(params[i], charset));
                sb.append("=");
                sb.append(URLEncoder.encode(params[i + 1], charset));
            }
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return sb.substring(1);
    }
public static String paramsToString(String charset, String... params) {
        StringBuffer sb = new StringBuffer();
        try {
            for (int i = 0; i < params.length - 1; i = i + 1) {
                sb.append("&");
                sb.append(URLEncoder.encode(params[i], charset));
                sb.append("=");
                sb.append(URLEncoder.encode(params[i + 1], charset));
            }
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return sb.substring(1);
    }
convert parameters to string

@param charset
编码
@param params
parameter
@return 拼接后的字符串