Here you can find the source of encodeToForm(Map msg)
public static String encodeToForm(Map msg)
//package com.java2s; //License from project: Open Source License import java.util.*; import java.net.*; public class Main { public static String encodeToForm(Map msg) { StringBuffer sb = new StringBuffer(); String name;//from w w w . j av a2 s . co m Object value; Iterator it = msg.keySet().iterator(); while (it.hasNext()) { name = (String) it.next(); value = URLEncoder.encode((String) msg.get(name)); sb.append(name + "=" + value); if (it.hasNext()) sb.append("&"); } return sb.toString(); } }