Here you can find the source of hashcode(final int[] array)
Parameter | Description |
---|---|
array | a parameter |
public static final int hashcode(final int[] array)
//package com.java2s; /*//from w ww . ja v a 2 s . c om * ARX: Powerful Data Anonymization * Copyright 2012 - 2016 Fabian Prasser, Florian Kohlmayer and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class Main { /** * Computes a hashcode for an integer array, partially unrolled. * * @param array * @return the hashcode */ public static final int hashcode(final int[] array) { final int len = array.length; int result = 23; int i = 0; // Do blocks of four ints unrolled. for (; (i + 3) < len; i += 4) { result = (1874161 * result) + // 37 * 37 * 37 * 37 (50653 * array[i]) + // 37 * 37 * 37 (1369 * array[i + 1]) + // 37 * 37 (37 * array[i + 2]) + array[i + 3]; } // Do the rest for (; i < len; i++) { result = (37 * result) + array[i]; } return result; } }