Java Hash Calculate hash(int value)

Here you can find the source of hash(int value)

Description

hash

License

Open Source License

Declaration

public static int hash(int value) 

Method Source Code

//package com.java2s;
/*/*from ww w . ja v  a2s .  co  m*/
* Copyright (c) 2003, the JUNG Project and the Regents of the University 
* of California
* All rights reserved.
*
* This software is open-source under the BSD license; see either
* "license.txt" or
* http://jung.sourceforge.net/license.txt for a description.
*/

public class Main {
    private static final int K = 10;
    private static final int INT_SIZE = 32;
    private static final int KnuthsAValue = (int) 2654435769L;

    public static int hash(int value) {
        return (value * KnuthsAValue) >>> (INT_SIZE - K);
    }
}

Related

  1. hash(int seed, int i)
  2. hash(int seed, int toHash)
  3. hash(int seed, int val)
  4. hash(int state1, int state2, int numStates1)
  5. hash(int val)
  6. hash(int x, int y)
  7. hash(long key)
  8. hash(long mover, long enemy)
  9. hash(Object a, Object b)