Java Hash Code Calculate hashCode(int[] ai)

Here you can find the source of hashCode(int[] ai)

Description

hash Code

License

LGPL

Declaration

public static int hashCode(int[] ai) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static int hashCode(int[] ai) {
        int hashcode = 0;
        for (int i : ai) {
            hashcode = hashcode * 31 + i;
        }//w w w  .  j  a va  2s  .com
        return hashcode;
    }

    public static int hashCode(byte[] ab) {
        int hashcode = 0;
        for (byte b : ab) {
            hashcode = hashcode * 31 + b;
        }
        return hashcode;
    }
}

Related

  1. hashCode(int num)
  2. hashCode(int previous, boolean x)
  3. hashCode(int result, Object obj)
  4. hashCode(int val)
  5. hashCode(int[] a)
  6. hashCode(int[] array)
  7. hashCode(int[][] arrays)
  8. hashCode(Iterable iterable)
  9. hashCode(long a[])