// Here is how to use the HashSet created with MakeHash //Create a HashSet variable somewhere. private static HashSet wordSet = null; // Read in the file created with MakeHash. Preferably do this just once when you // initialize your program. static // Try to initialize the spelling table { try { ObjectInputStream s = new ObjectInputStream(new FileInputStream("words.hashset")); wordSet = (HashSet) s.readObject(); } catch(Exception e) { System.out.println("No Spell Checking"); } } // Now wordSet should be available for checking. To check a string do this: static boolean spellCheck(String s)throws IOException { if(wordSet == null) return false; return wordSet.contains(s); } // You can add words to wordSet, of course, but if you do, you should probably // write it back to disk the way MakeHash does. // If you have a longer string and want to check individual words in it, you can use a StringTokenizer // to break it up into words and then check each word separately as above.