Java tutorial
//package com.java2s; import java.util.Map; public class Main { /** * Formats HTTP headers. * * @param headers * The headers. * @return Headers as a string */ private static String formatHttpHeaders(Map<String, String> headers) { StringBuilder sb = new StringBuilder(); for (Map.Entry<String, String> header : headers.entrySet()) { sb.append(String.format("%s : %s\n", header.getKey(), header.getValue())); } return sb.toString(); } }