Java Double to Byte Array doubleToBytes(double v, byte[] bytes, int off)

Here you can find the source of doubleToBytes(double v, byte[] bytes, int off)

Description

double To Bytes

License

Open Source License

Declaration

public static void doubleToBytes(double v, byte[] bytes, int off) 

Method Source Code

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

public class Main {
    public static void doubleToBytes(double v, byte[] bytes, int off) {
        long el = Double.doubleToRawLongBits(v);
        int shift = 64;
        int lim = off + 8;
        for (int i = off; i < lim; i++) {
            shift -= 8;/* www .j a  v a2  s .co m*/
            bytes[i] = (byte) ((el >> shift) & 0xFF);
        }
    }
}

Related

  1. doubleToBytes(double d)
  2. doubleToBytes(double d, byte[] bytes, int off, boolean bigEndian)
  3. doubleToBytes(double d, byte[] data, int[] offset)
  4. doubleToBytes(double dnum, byte[] bytes, int startIndex)
  5. doubleToBytes(double v, byte[] bytes)
  6. doubleToBytes(double value)
  7. doubleToBytes(final double d)
  8. doubleToBytes(final double val)
  9. DoubleToBytes_With_Little_Endian(double number)