Java 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

inthashCode(char[] array)
hash Code
int h = 0;
int len = array.length;
for (int i = 0; i < len; i++) {
    h = 31 * h + array[i];
return (h);
inthashCode(char[] array, int start, int end)
Returns hash of chars in range start (inclusive) to end (inclusive)
int code = 0;
for (int i = end - 1; i >= start; i--) {
    code = code * 31 + array[i];
return code;
inthashCode(char[] array, int start, int end)
Returns hash of chars in range start (inclusive) to end (inclusive)
int code = 0;
for (int i = end - 1; i >= start; i--)
    code = code * 31 + array[i];
return code;
inthashCode(CharSequence seq)
hash Code
final int prime = 31;
int result = 1;
for (int i = 0, len = seq.length(); i < len; i++) {
    result = prime * result + seq.charAt(i);
return result;
inthashCode(double dbl)
Return the same value as Double#hashCode() .
long bits = Double.doubleToLongBits(dbl);
return hashCode(bits);
inthashCode(double v)
Computes the hash code of a double value.
long bits = Double.doubleToLongBits(v);
return hashCode(bits);
inthashCode(double val)
Returns a hash code for the specified double value.
return hashCode(Double.doubleToLongBits(val));
inthashCode(final byte[] data)
hash Code
if (data == null)
    return Integer.MIN_VALUE;
final int prime = 0x01000193;
int hash = 0x811c9dc5;
for (int i = data.length - 1; i >= 0; i--) {
    hash = (hash ^ data[i]) * prime;
return hash;
...
inthashCode(final char[] text, final int textOffset, final int textLen)
hash Code
int h = 0;
int off = textOffset;
for (int i = 0; i < textLen; i++) {
    h = 31 * h + text[off++];
return h;
inthashCode(final int i)
Provides a hash code based on the given integer value.
return i;