Here you can find the source of hashCode(byte[] bytes, int size)
public static int hashCode(byte[] bytes, int size)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w w w . j a v a2s . c om*/ * A function that calculates hash code of a byte array based on its * contents but using the given size parameter as deliminator for the * content. */ public static int hashCode(byte[] bytes, int size) { int contentLimit = size; if (size > bytes.length) contentLimit = bytes.length; int hashCode = 1; for (int i = 0; i < contentLimit; i++) hashCode = 31 * hashCode + bytes[i]; return hashCode; } }