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