I am working on a java project for school. I am trying to think more into a professional mindset rather than a student. The project I am working on is about hashing. The rest of the project looks really good, but this part makes me wonder if a professional programmer would do this. From what I understand is Java is mostly understanding, implementing, and manipulating algorithms. To me this seems like I just used a simple algorithm to obtain the desired result. I just want to see if it seems efficient and professional. So in your professional opinion does this look professional and efficient?
/**
* Changes String to int
* @param key: String
* @return (result % arraySize): int
*/
public int hashFunc (String key)
{
int result = 0;
String inputString = key.toString().toLowerCase();
// changes String to lowercase
char [] characters = inputString.toCharArray(); // makes String an Array
for (int index = 0; index < characters.length; index++) // loop
{
result+=characters[index]-9;
//adds result and subtracts 9 to make unicode into values A,B,C...=1,2,3...
}// end for
return (result % arraySize); // returns Hashed values
} // end hashFunc()
The pseudocode logic for this is
set result to zero
change Strings to lower-case
make the string an array of chars
loop through the string
obtain the unicode value of current character and subtract 9
add this result to other character results in the string(+=)
(the unicode of a=10 subtract 9 and it converts the unicode into the desired numberset.)
return result total mod ArraySize(29 in this project)
Thanks for your help!