Java tutorial
//package com.java2s; import java.util.Map; import java.util.Map; public class Main { public static String mapToQueryString(Map<String, String> map) { StringBuilder string = new StringBuilder(); if (map.size() > 0) { string.append("?"); } for (Map.Entry<String, String> entry : map.entrySet()) { string.append(entry.getKey()); string.append("="); string.append(entry.getValue()); string.append("&"); } return string.toString(); } }