You can't guarantee uniqueness with a fixed length hash if your source is arbitrary length strengths. But, you can do a lot better than the
Java hashcode. If you need maximal uniqueness, then look for hashing functions used in encryption. MD5 and SHA1 are popular examples. I think they are both well supported by the JCE. Look for the MessageDigest class.