Java Double to Byte Array doubleToByteArray(double d)

Here you can find the source of doubleToByteArray(double d)

Description

double To Byte Array

License

Apache License

Declaration

public static byte[] doubleToByteArray(double d) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static byte[] doubleToByteArray(double d) {
        long l = Double.doubleToRawLongBits(d);
        return new byte[] { (byte) ((l >> 0) & 0xff), (byte) ((l >> 8) & 0xff), (byte) ((l >> 16) & 0xff),
                (byte) ((l >> 24) & 0xff), (byte) ((l >> 32) & 0xff), (byte) ((l >> 40) & 0xff),
                (byte) ((l >> 48) & 0xff), (byte) ((l >> 56) & 0xff) };
    }/*from   w ww.ja v  a  2  s.c  om*/
}

Related

  1. double2bytes(double v, byte[] b)
  2. double2bytes(double v, int len)
  3. double2bytes(double value)
  4. double2bytes(double x)
  5. double2bytesLE(double val, byte[] b, int off)
  6. doubleToByteArray(double number)
  7. doubleToByteArray(double source)
  8. doubleToByteArray(double value)
  9. doubleToByteArrayBE(double data)