- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
static private Double getHashString(String string, Integer foundation){
Double hash = 0.0 ;
short [] charsToInteger = getCharArray(string);
double step = Double.MAX_VALUE / 256 - foundation;
for (int i = 0; i < charsToInteger.length ; i++ ){
hash += charsToInteger[i] * step;
step = step / 2 - 1;
}
return hash;
}
static private short [] getCharArray(String string){
char [] chars = string.toLowerCase().toCharArray();
short [] bytes = new short [chars.length];
for (int i = 0; i < chars.length; i++){
bytes [i] = (short) (chars[i] & 0x00FF);
//System.out.println("bytes [" + i + "] = " + bytes[i]);
}
return bytes;
}