List of usage examples for java.lang Double doubleToLongBits
@HotSpotIntrinsicCandidate public static long doubleToLongBits(double value)
From source file:Main.java
public static void writeDouble(DataOutputStream os, double d) throws IOException { writeLong(os, Double.doubleToLongBits(d)); }
From source file:Main.java
public static double getDouble(final SharedPreferences prefs, final String key, final double defaultValue) { return Double.longBitsToDouble(prefs.getLong(key, Double.doubleToLongBits(defaultValue))); }
From source file:Main.java
/** * Generated UID to anonymously identify users on GCM server. * @return//from ww w .java2 s . c o m */ public static String generateUid() { return Long.toHexString(Double.doubleToLongBits(Math.random())); }
From source file:Main.java
public static final void writeDouble(OutputStream o, double v) throws IOException { writeLong(o, Double.doubleToLongBits(v)); }
From source file:Main.java
public static void writeDouble(OutputStream out, double d, boolean big_endian) throws IOException { long bits = Double.doubleToLongBits(d); writeNumber(out, bits, 8, big_endian); }
From source file:Main.java
/** * Util method that converts a double into a byte array using a buffer. * * @param buffer The buffer to put the converted double * @param pos The position to start putting the converted double * @param input The double to convert//from ww w . j av a 2 s . c o m */ public static void putDoubleToBytes(byte[] buffer, int pos, double input) { /* Get the double representation in order bitwise operations */ long value = Double.doubleToLongBits(input); /* Convert the double into array of bytes */ for (int i = pos; i < pos + DOUBLE_SIZE; i++) { buffer[i] = (byte) (value >> (((DOUBLE_SIZE - 1) - (i - pos)) * BITS_IN_BYTE)); } }
From source file:Main.java
private static int writeDouble(byte[] buffer, int offset, double value) { return writeLong(buffer, offset, Double.doubleToLongBits(value)); }
From source file:Main.java
public static void putDouble(SharedPreferences.Editor prefEditor, String key, double val) { prefEditor.putLong(key, Double.doubleToLongBits(val)); }
From source file:Main.java
public static double getDouble(SharedPreferences pref, String key, double defVal) { return Double.longBitsToDouble(pref.getLong(key, Double.doubleToLongBits(defVal))); }
From source file:Main.java
public static long doubleToLongBits(double value) { return Double.doubleToLongBits(value); }