Android Utililty Methods Hash Code Calculate

List of utility methods to do Hash Code Calculate

Description

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

Method

inthashBitmap(Bitmap bitmap)
hash Bitmap
int hash_result = 0;
int w = bitmap.getWidth();
int h = bitmap.getHeight();
hash_result = (hash_result << 7) ^ h;
hash_result = (hash_result << 7) ^ w;
for (int pixel = 0; pixel < 20; ++pixel) {
    int x = (pixel * 50) % w;
    int y = (pixel * 100) % h;
...
inthashCode(T a)
hash Code
return (a == null) ? 0 : a.hashCode();
inthashCode(T a, T b)
hash Code
int h = hashCode(a);
int x = (b == null) ? 0 : b.hashCode();
h = ((h << 5) - h) ^ x; 
return h;
inthashCode(T a, T b, T c)
hash Code
int h = hashCode(a, b);
int x = (c == null) ? 0 : c.hashCode();
h = ((h << 5) - h) ^ x; 
return h;
inthashCode(T a, T b, T c, T d)
hash Code
int h = hashCode(a, b, c);
int x = (d == null) ? 0 : d.hashCode();
h = ((h << 5) - h) ^ x; 
return h;
inthashCode(T[] array)
Hash every element uniformly using the Modified Bernstein hash.
if (array == null) {
    return 0;
int h = 1;
for (T o : array) {
    int x = (o == null) ? 0 : o.hashCode();
    h = ((h << 5) - h) ^ x; 
return h;
inthashCode(float[] array)
Hash every element uniformly using the Modified Bernstein hash.
if (array == null) {
    return 0;
int h = 1;
for (float f : array) {
    int x = Float.floatToIntBits(f);
    h = ((h << 5) - h) ^ x; 
return h;
inthashCode(int x)
hash Code
return hashCode(new int[] { x });
inthashCode(int x, int y)
hash Code
return hashCode(new int[] { x, y });
inthashCode(int x, int y, int z)
hash Code
return hashCode(new int[] { x, y, z });