Java tutorial
//package com.java2s; import java.util.Iterator; import java.util.Map; public class Main { private static StringBuffer getParamString(Map<String, String> params) { StringBuffer result = new StringBuffer(); Iterator<Map.Entry<String, String>> iterator = params.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, String> param = iterator.next(); String key = param.getKey(); String value = param.getValue(); result.append(key).append('=').append(value); if (iterator.hasNext()) { result.append('&'); } } return result; } }