Here you can find the source of encodeParams(Map nameValuePairs)
public static String encodeParams(Map nameValuePairs)
//package com.java2s; //License from project: Open Source License import java.net.*; import java.util.*; public class Main { public static String encodeParams(Map nameValuePairs) { StringBuffer params = new StringBuffer(); Iterator nvp = nameValuePairs.keySet().iterator(); String name, value;/*from w w w.ja va 2 s . com*/ char ch; while (nvp.hasNext()) { name = (String) nvp.next(); value = (String) nameValuePairs.get(name); if (value == null) value = "null"; if (nvp.hasNext()) ch = '&'; else ch = '\n'; params.append(name + "=" + URLEncoder.encode(value) + ch); } return params.toString(); } }