Here you can find the source of byteArrayHashCode(final byte[] array)
Parameter | Description |
---|---|
array | The array to obtain the hash code off. |
public static final int byteArrayHashCode(final byte[] array)
//package com.java2s; /*/*from w w w . jav a2s . com*/ * 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. */ import java.util.Arrays; public class Main { /** * Obtain the hashcode of a byte array. * * @param array * The array to obtain the hash code off. * @return The hash code of the array. */ public static final int byteArrayHashCode(final byte[] array) { // int i, s; // // if (array == null) // return -3413; // i = array.length; // if (i <= 0) // return -928547; // // s = byteHashCode(array[0]); // for (--i; i > 0; i--) { // s = combineHashCodes(s, array[i]); // } // // return s; return Arrays.hashCode(array); } }