Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Map; public class Main { /** * use ? & make a full url * @param p_url * @param params * @return */ public static String makeURL(String p_url, Map<String, String> params) { StringBuilder url = new StringBuilder(p_url); if (url.indexOf("?") < 0) url.append('?'); for (String name : params.keySet()) { url.append('&'); url.append(name); url.append('='); url.append(String.valueOf(params.get(name))); } return url.toString().replace("?&", "?"); } }