兄弟们,最后还是被我发现虚拟机的中的计算公式{:soso_e182:}int java.lang.String.hashCode()
hashCode
public int hashCode()
Returns a hash code for this string. The hash code for a String object is computed as
s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]//计算公式
using int arithmetic(算法), where s[i] is the ith character of the string, n is the length of the string, and ^ indicates(表示) exponentiation(取幂). (The hash value of the empty string is zero.)
Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable |