Example usage for java.lang Double longBitsToDouble

List of usage examples for java.lang Double longBitsToDouble

Introduction

In this page you can find the example usage for java.lang Double longBitsToDouble.

Prototype

@HotSpotIntrinsicCandidate
public static native double longBitsToDouble(long bits);

Source Link

Document

Returns the double value corresponding to a given bit representation.

Usage

From source file:Main.java

public static void main(String[] args) {
    Double d = new Double("1.30");

    System.out.println(d.longBitsToDouble(6757689));
    System.out.println(d.longBitsToDouble(0x7ff0000000000000L));
    System.out.println(d.longBitsToDouble(0xfff0000000000000L));
}

From source file:Main.java

public static void main(String[] args) {
    long test = 0x401aaa9930be0dedL;
    double d = Double.longBitsToDouble(test);
    System.out.println(d);/*from  w  w  w.  j  ava  2s .c o m*/
}

From source file:Main.java

public static void main(String[] args) {

    System.out.println(Double.MIN_VALUE);
    System.out.println(Double.longBitsToDouble(0x1L));
}

From source file:Main.java

public static void main(String[] args) {

    System.out.println(Double.MAX_VALUE);
    System.out.println(Double.longBitsToDouble(0x7fefffffffffffffL));
}

From source file:Main.java

public static double getDouble(byte[] bytes) {
    long l = getLong(bytes);
    return Double.longBitsToDouble(l);
}

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

public static double getDouble(byte[] bytes) {
    long l = getLong(bytes);
    System.out.println(l);/* w ww. jav  a  2s  . co m*/
    return Double.longBitsToDouble(l);
}

From source file:Main.java

public static final double readDouble(InputStream i) throws IOException {
    return Double.longBitsToDouble(readLong(i));
}

From source file:Main.java

/**
 * Returns next bigger double value considering precision of the argument.
 * /*from  w  w  w  . j  a v  a  2s. co m*/
 */
public static double nextUp(double d) {
    if (Double.isNaN(d) || d == Double.POSITIVE_INFINITY) {
        return d;
    } else {
        d += 0.0;
        return Double.longBitsToDouble(Double.doubleToRawLongBits(d) + ((d >= 0.0) ? +1 : -1));
    }
}

From source file:Main.java

/**
 * Replacement for the Math.nextUp(...) method that is only available in
 * HONEYCOMB and higher. Dat's some seeeeek sheeet.
 *
 * @param d//  w  w w .  j  ava2s.  c  o  m
 * @return
 */
public static double nextUp(double d) {
    if (d == Double.POSITIVE_INFINITY)
        return d;
    else {
        d += 0.0d;
        return Double.longBitsToDouble(Double.doubleToRawLongBits(d) + ((d >= 0.0d) ? +1L : -1L));
    }
}