Java tutorial
//package com.java2s; import java.util.*; public class Main { public static Hashtable<Character, Integer> createHashtable(String text) { Hashtable<Character, Integer> textHashTable = new Hashtable<Character, Integer>(); for (char c : text.toCharArray()) { if (textHashTable.get(c) != null) { Integer temp = textHashTable.get(c); textHashTable.put(c, temp + 1); } else { textHashTable.put(c, new Integer(1)); } } return textHashTable; } }