PDA

Click to See Complete Forum and Search --> : hashCode() algorithm


lupdawg
February 25th, 2004, 11:51 PM
Does anybody know the algorithm that java uses to get the hashCode for the built in hash table...or can any body give me the source code for that method. It is for a java assignment and i cant figure out that pattern by looking at the numbers, and i couldnt find the actual code in the API

any help would be great, THANKS :confused:

groovicus
February 26th, 2004, 02:02 AM
Stupid question, because I am only about 6 weeks into java....

If you know the library it is in ( java.lang.Object ) then why not snoop around a little in the classes and figure it out? That's what I have been doing, and how I found examples of parameter passing in instantiable classes....

and i couldnt find the actual code in the API

Wouldn't that be because that just gives you the syntax necessary to make the call?

Just my input....I've got my own java homework to figure out. ;)

lupdawg
February 26th, 2004, 05:39 AM
i know how to use the method, i know how to call the method...but i need the actual algorithm of the method. the method takes a string, and spits back out a int. how does it get from point a to point b... i need that 'formula' and i was searching all the documentation for the actaul source code...i mis typed it and said the API

Thanks for the help tho :)

mikem0327
March 9th, 2004, 02:05 AM
Well it would help if you gave us the numbers so we could work with them.
A simple google search found this website
http://mindprod.com/jgloss/hashtable.html
that might help.
Is it a homemade algorithm or is it a known one?