Here you can find the source of buildQuery(Map
public static String buildQuery(Map<String, Object> paramMap)
//package com.java2s; //License from project: Apache License import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Map; public class Main { public static String buildQuery(Map<String, Object> paramMap) { StringBuilder localStringBuilder = new StringBuilder(); for (Map.Entry<String, Object> localEntry : paramMap.entrySet()) { if (localStringBuilder.length() > 0) { localStringBuilder.append('&'); }/* ww w . j av a 2 s . c o m*/ try { localStringBuilder.append(URLEncoder.encode((String) localEntry.getKey(), "UTF-8")); } catch (UnsupportedEncodingException localUnsupportedEncodingException1) { localUnsupportedEncodingException1.printStackTrace(); } if (localEntry.getValue() != null) { localStringBuilder.append('='); try { localStringBuilder.append(URLEncoder.encode(localEntry.getValue().toString(), "UTF-8")); } catch (UnsupportedEncodingException localUnsupportedEncodingException2) { localUnsupportedEncodingException2.printStackTrace(); } } } return localStringBuilder.toString(); } }