Java Integer Hash intHashCode(final int value)

Here you can find the source of intHashCode(final int value)

Description

Create a hash code of an integer value.

License

LGPL

Parameter

Parameter Description
value The integer value to create a hash code off.

Return

The hash code of the integer value.

Declaration

public static final int intHashCode(final int value) 

Method Source Code

//package com.java2s;
/*/*from  w  w w. j  ava2s .c  o  m*/
 * Copyright (c) 2006 Thomas Weise
 * Software Foundation Classes
 * http://sourceforge.net/projects/java-sfc
 * 
 * E-Mail           : tweise@gmx.de
 * Creation Date    : 2006-11-22
 * Creator          : Thomas Weise
 * Original Filename: org.sfc.utils.HashUtils.java
 * Last modification: 2006-11-22
 *                by: Thomas Weise
 * 
 * License          : GNU LESSER GENERAL PUBLIC LICENSE
 *                    Version 2.1, February 1999
 *                    You should have received a copy of this license along
 *                    with this library; if not, write to theFree Software
 *                    Foundation, Inc. 51 Franklin Street, Fifth Floor,
 *                    Boston, MA 02110-1301, USA or download the license
 *                    under http://www.gnu.org/licenses/lgpl.html or
 *                    http://www.gnu.org/copyleft/lesser.html.
 *                    
 * Warranty         : This software is provided "as is" without any
 *                    warranty; without even the implied warranty of
 *                    merchantability or fitness for a particular purpose.
 *                    See the Gnu Lesser General Public License for more
 *                    details.
 */

public class Main {
    /**
     * Create a hash code of an integer value.
     * 
     * @param value
     *          The integer value to create a hash code off.
     * @return The hash code of the integer value.
     */
    public static final int intHashCode(final int value) {
        int v;

        v = (value + 0xad4497fc);
        v += ~(v << 9);
        v ^= (v >>> 14);
        v += (v << 4);
        v ^= (v >>> 10);

        return v;
    }
}

Related

  1. intHash(int i)
  2. intHash(int input)
  3. intHash(int key)
  4. intHash(int number, int max)
  5. intHash(long a)
  6. intHashCode(int i)
  7. intHashToLong(int hash)