Java Hash Calculate calculateHash(Long... ids)

Here you can find the source of calculateHash(Long... ids)

Description

Calculate the hash code.

License

Open Source License

Parameter

Parameter Description
ids the list of ids to be used.

Return

the calculated hash

Declaration

public static int calculateHash(Long... ids) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*  www  . ja  v  a  2s  . c  o m*/
     * <p>
     * Calculate the hash code.
     * </p>
     * 
     * @param ids
     *            the list of ids to be used.
     * @return the calculated hash
     */
    public static int calculateHash(Long... ids) {
        final int prime = 31;
        final int offset = 32;
        int result = 1;
        for (Long id : ids) {
            if (id != null) {
                result = prime * result + (int) (id ^ (id >>> offset));
            }
        }
        return result;
    }
}

Related

  1. calculateHash(int x, int y)
  2. calculateHash(String str)
  3. calculateHashCode(byte a[])
  4. getHash(byte[] bytes)
  5. getHash(byte[] bytes)