I want to take a String str and an int wSize and use it to create a hashtable. An example is the best way to explain what I want.
For example: str = "alphabet" wSize = 2
I want a hashtable that looks like this: al 0 lp 1 ph 2 ha 3 ab 4 be 5 et 6
This is what I have so far
public static void hashTableCreator (String str, int wSize) {
Hashtable ht = new Hashtable();
str = "alphabet";
wSize = 2;
String str2;
for (int i = 0; i < str.length(); i++) {
int value = 0;
ht.put(str.substring(i, i + 1), value);
value++;
}
Set set = ht.keySet();
Iterator itr = set.iterator();
while(itr.hasNext()) {
str2 = (String) itr.next();
System.out.println(str2 + ": " +
ht.get(str2));
}
}