Java Double to Byte Array double2bytes(double x)

Here you can find the source of double2bytes(double x)

Description

doublebytes

License

Apache License

Declaration

public static byte[] double2bytes(double x) 

Method Source Code

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

public class Main {
    public static byte[] double2bytes(double x) {
        long l = Double.doubleToLongBits(x);
        return long2bytes(l);
    }//from  w  w w  . j a v a2 s.com

    public static byte[] long2bytes(long num) {
        byte[] buf = new byte[8];
        for (int i = buf.length - 1; i >= 0; i--) {
            buf[i] = (byte) (num & 0x00000000000000ff);
            num >>= 8;
        }
        return buf;
    }
}

Related

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