Here you can find the source of doubleToHashString(double value)
public static String doubleToHashString(double value)
//package com.java2s; /*/* w w w .ja v a 2 s . co m*/ * Copyright 2017 Google Inc. * * Licensed 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 { private static final char[] HEX_CHARACTERS = "0123456789abcdef".toCharArray(); public static String doubleToHashString(double value) { StringBuilder sb = new StringBuilder(16); long bits = Double.doubleToLongBits(value); // We use big-endian to encode the bytes for (int i = 7; i >= 0; i--) { int byteValue = (int) ((bits >>> (8 * i)) & 0xff); int high = ((byteValue >> 4) & 0xf); int low = (byteValue & 0xf); sb.append(HEX_CHARACTERS[high]); sb.append(HEX_CHARACTERS[low]); } return sb.toString(); } }