Java Double to Byte doubleToByte(double i_Value)

Here you can find the source of doubleToByte(double i_Value)

Description

double To Byte

License

Open Source License

Declaration

public static byte[] doubleToByte(double i_Value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    public static byte[] doubleToByte(double i_Value) {
        return longToByte(Double.doubleToLongBits(i_Value));
    }/*w  w w .j  a va2  s  .  com*/

    public static byte[] longToByte(long i_Value) {
        byte[] v_Ret = new byte[8];

        v_Ret[0] = (byte) ((i_Value >>> 56) & 0xFF);
        v_Ret[1] = (byte) ((i_Value >>> 48) & 0xFF);
        v_Ret[2] = (byte) ((i_Value >>> 40) & 0xFF);
        v_Ret[3] = (byte) ((i_Value >>> 32) & 0xFF);
        v_Ret[4] = (byte) ((i_Value >>> 24) & 0xFF);
        v_Ret[5] = (byte) ((i_Value >>> 16) & 0xFF);
        v_Ret[6] = (byte) ((i_Value >>> 8) & 0xFF);
        v_Ret[7] = (byte) ((i_Value >>> 0) & 0xFF);

        return v_Ret;
    }
}

Related

  1. double2byte(double d)
  2. Double2Byte(double i)
  3. doubleToByte(double d)
  4. doubleToByte(double d)
  5. doubleToByte(double d)
  6. doubleToByte(double[] values)
  7. doubleToByte(final double value)