Here you can find the source of hashCode(int num)
Parameter | Description |
---|---|
num | The int to be hashed. |
public static int hashCode(int num)
//package com.java2s; /*//from w w w .j av a 2 s .c o m * This file is part of the Raster Storage Archive (RSA). * * The RSA is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * The RSA is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * the RSA. If not, see <http://www.gnu.org/licenses/>. * * Copyright 2013 CRCSI - Cooperative Research Centre for Spatial Information * http://www.crcsi.com.au/ */ public class Main { /** * Hash code used in hashing int */ public static int HASH_CODE = 123456789; /** * Hash the specified int using implementation proposed in Josh Bloch's * "Effective Java". Refer to * http://stackoverflow.com/questions/113511/hash-code-implementation * * @param num * The int to be hashed. * @return Returns the hash code of the int. */ public static int hashCode(int num) { return 37 * HASH_CODE + num; } }