Method to get the hash code for double data type - Java java.lang

Java examples for java.lang:double

Description

Method to get the hash code for double data type

Demo Code


//package com.java2s;

public class Main {
    /**//from w  ww .  j  a v  a 2  s.  c  o m
     * Method to get the hash code for double data type
     * 
     * @param doubleValue
     *            value to return hash code for
     * @return int containing has code
     */
    public static int hashCode(double doubleValue) {
        long v = Double.doubleToLongBits(doubleValue);
        return (int) (v ^ (v >>> 32));
    }
}

Related Tutorials