Here you can find the source of deepHashCode(byte[] array)
Parameter | Description |
---|---|
array | the array to compute the hashcode of |
public static int deepHashCode(byte[] array)
//package com.java2s; public class Main { /**/*from www . j a v a 2 s. c om*/ * Computes a hashcode based on the contents of a one-dimensional byte array * rather than its identity. * * @param array the array to compute the hashcode of * @return the hashcode */ public static int deepHashCode(byte[] array) { int result = 1; for (int i = 0; i < array.length; i++) { result = 31 * result + array[i]; } return result; } /** * Computes a hashcode based on the contents of a two-dimensional byte array * rather than its identity. * * @param array the array to compute the hashcode of * @return the hashcode */ public static int deepHashCode(byte[][] array) { int result = 1; for (int i = 0; i < array.length; i++) { result = 31 * result + deepHashCode(array[i]); } return result; } /** * Computes a hashcode based on the contents of a three-dimensional byte * array rather than its identity. * * @param array the array to compute the hashcode of * @return the hashcode */ public static int deepHashCode(byte[][][] array) { int result = 1; for (int i = 0; i < array.length; i++) { result = 31 * result + deepHashCode(array[i]); } return result; } }