Java's String hashCode is computed as a polynomial hash of the string's characters using the prime number 31 as the base. The choice of 31 is intentional: it's prime, and 31-1=30... actually 31 is chosen because it and 29 (31-2) are both primes. For long strings, the JVM can leverage CPU SIMD instructions. Since String is

1m watch time

Sort: