Here you can find the source of doubleToRegisters(double d)
Parameter | Description |
---|---|
d | the double to be converted. |
public static final byte[] doubleToRegisters(double d)
//package com.java2s; //License//from w w w . j a v a2s .com public class Main { /** * Converts a double value to a byte[8]. * * @param d the double to be converted. * @return a byte[8]. */ public static final byte[] doubleToRegisters(double d) { return longToRegisters(Double.doubleToLongBits(d)); } /** * Converts a long value to a byte[8]. * * @param v the value to be converted. * @return a byte[8] containing the long value. */ public static final byte[] longToRegisters(long v) { byte[] registers = new byte[8]; registers[0] = (byte) (0xff & (v >> 56)); registers[1] = (byte) (0xff & (v >> 48)); registers[2] = (byte) (0xff & (v >> 40)); registers[3] = (byte) (0xff & (v >> 32)); registers[4] = (byte) (0xff & (v >> 24)); registers[5] = (byte) (0xff & (v >> 16)); registers[6] = (byte) (0xff & (v >> 8)); registers[7] = (byte) (0xff & v); return registers; } }