Java tutorial
//package com.java2s; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; public class Main { public static String transMapToString(Map<String, String> map) { Entry<String, String> entry; StringBuilder sb = new StringBuilder(); for (Iterator<Entry<String, String>> iterator = map.entrySet().iterator(); iterator.hasNext();) { entry = iterator.next(); sb.append(entry.getKey().toString()).append("=") .append(null == entry.getValue() ? "" : entry.getValue().toString()) .append(iterator.hasNext() ? "&" : ""); } return sb.toString(); } }