Here you can find the source of printHash(Hashtable ht)
public static String printHash(Hashtable ht)
//package com.java2s; import java.util.Enumeration; import java.util.Hashtable; public class Main { public static String printHash(Hashtable ht) { StringBuffer sb = new StringBuffer(""); if (ht != null && !ht.isEmpty()) { sb.append("Contents of Hashtable:\n"); Enumeration en = ht.keys(); while (en.hasMoreElements()) { String k = (String) en.nextElement(); sb.append("* " + k + " = "); sb.append(ht.get(k).toString()); sb.append("\n"); }//from w ww .j av a 2 s . co m } return sb.toString(); } }