Java Utililty Methods Integer Hash

List of utility methods to do Integer Hash

Description

The list of methods to do Integer Hash are organized into topic(s).

Method

intintHash(final long a)
If the specified value is in int range, the returned value is identical.
int hash = (int) (a >> 32) + (int) a;
if (a < 0) {
    hash++;
return hash;
intintHash(int i)
int Hash
return (i << 16) | (i >>> 16);
intintHash(int input)
Redistribute integer identifier keyspace using Knuth's multiplicative method.
long unsignedValue = ((long) input) - Integer.MIN_VALUE;
long unsignedIntMax = (1l << 32);
long unsignedHashValue = ((unsignedValue * 2654435761l) % unsignedIntMax);
return (int) (unsignedHashValue + Integer.MIN_VALUE);
intintHash(int key)
int Hash
key += ~(key << 15);
key ^= (key >>> 10);
key += (key << 3);
key ^= (key >>> 6);
key += ~(key << 11);
key ^= (key >>> 16);
return key;
intintHash(int number, int max)
int Hash
int hash = number % max;
return hash < 0 ? hash * -1 : hash;
intintHash(long a)
If the specified value is in int range, the returned value is identical.
if (false) {
    int hash = ((int) (a >> 32)) ^ ((int) a);
    if (a < 0) {
        hash = -hash - 1;
    return hash;
int hash = ((int) (a >> 32)) + ((int) a);
...
intintHashCode(final int value)
Create a hash code of an integer value.
int v;
v = (value + 0xad4497fc);
v += ~(v << 9);
v ^= (v >>> 14);
v += (v << 4);
v ^= (v >>> 10);
return v;
intintHashCode(int i)
int Hash Code
return i;
longintHashToLong(int hash)
int Hash To Long
return (long) hash;