Here you can find the source of buildQueryString(Map parameters)
private static String buildQueryString(Map parameters) throws UnsupportedEncodingException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.net.URLEncoder; import java.util.Iterator; import java.util.Map; public class Main { /**//from w ww .java2s . com * Builds a query string from the provided key-value-pairs. All * spaces are substituted by '+' characters, and all non US-ASCII * characters are escaped to hexadecimal notation (%xx). */ private static String buildQueryString(Map parameters) throws UnsupportedEncodingException { StringBuffer queryString = new StringBuffer(20 * parameters.size()); for (Iterator it = parameters.entrySet().iterator(); it.hasNext();) { Map.Entry parameter = (Map.Entry) it.next(); // Escape both key and value and combine them with an '=' queryString.append(URLEncoder.encode((String) parameter.getKey(), "UTF-8")); queryString.append('='); queryString.append(URLEncoder.encode(String.valueOf(parameter.getValue()), "UTF-8")); if (it.hasNext()) queryString.append('&'); } return queryString.toString(); } }