Here you can find the source of hashCode(double dbl)
Double#hashCode()
.
public static int hashCode(double dbl)
//package com.java2s; /*// w w w. j a v a 2 s . c om * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class Main { /** * Return the same value as <code>{@link Boolean#hashCode()}</code>. * @see Boolean#hashCode() */ public static int hashCode(boolean bool) { return bool ? 1231 : 1237; } /** * Return the same value as <code>{@link Double#hashCode()}</code>. * @see Double#hashCode() */ public static int hashCode(double dbl) { long bits = Double.doubleToLongBits(dbl); return hashCode(bits); } /** * Return the same value as <code>{@link Float#hashCode()}</code>. * @see Float#hashCode() */ public static int hashCode(float flt) { return Float.floatToIntBits(flt); } /** * Return the same value as <code>{@link Long#hashCode()}</code>. * @see Long#hashCode() */ public static int hashCode(long lng) { return (int) (lng ^ (lng >>> 32)); } /** * <p>Gets the hash code of an object returning zero when the * object is {@code null}.</p> * * <pre> * ObjectUtils.hashCode(null) = 0 * ObjectUtils.hashCode(obj) = obj.hashCode() * </pre> * * @param obj the object to obtain the hash code of, may be {@code null} * @return the hash code of the object, or zero if null * @since 2.1 */ public static int hashCode(Object obj) { // hashCode(Object) retained for performance, as hash code is often critical return (obj == null) ? 0 : obj.hashCode(); } }