Java Hash Calculate hashClassName(Class clazz)

Here you can find the source of hashClassName(Class clazz)

Description

hash Class Name

License

Open Source License

Declaration

public static int hashClassName(Class clazz) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int hashClassName(Class clazz) {
        String className = clazz.getName();
        return hashString(className);
    }// w w w .  java  2  s  .co m

    public static int hashString(String str) {
        // See http://stackoverflow.com/questions/2624192/good-hash-function-for-strings
        int hash = 7;
        for (int i = 0; i < str.length(); i++) {
            hash = hash * 31 + str.charAt(i);
        }
        return hash;
    }
}

Related

  1. hashBerkeleyDB64(byte[] str)
  2. hashByteArray(byte[] array, int startInclusive, int endExclusive)
  3. hashBytes(int seed, byte[] data, int offset, int len)
  4. hashCapacityForSize(final int size)
  5. hashCharArray(int seed, char... charArray)
  6. hashCombine(int seed, int hash)
  7. hashCombine(int seed, int hash)
  8. hashDisp(long hash)
  9. hashDouble(double val)