Example usage for java.lang Double Double

List of usage examples for java.lang Double Double

Introduction

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

Prototype

@Deprecated(since = "9")
public Double(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Double object that represents the floating-point value of type double represented by the string.

Usage

From source file:DoubleDemo.java

public static void main(String args[]) {
    Double d1 = new Double(3.14159);
    Double d2 = new Double("314159E-5");

    System.out.println(d1 + " = " + d2 + " -> " + d1.equals(d2));
}

From source file:Main.java

public static void main(String[] args) {
    Double dObj = new Double(10.25);
    String str = dObj.toString();
    System.out.println(str);//from  w  w w  .j  ava2 s  .  co m
}

From source file:Main.java

public static void main(String args[]) {
    Double d1 = new Double(1 / 0.);
    Double d2 = new Double(0 / 0.);

    System.out.println(d1 + ": " + d1.isInfinite() + ", " + d1.isNaN());
    System.out.println(d2 + ": " + d2.isInfinite() + ", " + d2.isNaN());
}

From source file:Main.java

public static void main(String[] args) {

    Double d = new Double("10.50");

    System.out.println("Value = " + d.doubleToRawLongBits(2.5d));
}

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) {
    System.out.println(new Double(1.1));

}

From source file:Main.java

public static void main(String[] args) {
    System.out.println(new Double("1.2"));

}

From source file:Main.java

public static void main(String[] args) {

    Double d = new Double("5.3000000001");

    String retval = d.toString();
    System.out.println("Value = " + retval);
}

From source file:Main.java

public static void main(String[] args) {

    Double d = new Double("3.0001");

    int retval = d.hashCode();
    System.out.println("Value = " + retval);
}

From source file:Main.java

public static void main(String[] args) {
    Double double1 = new Double(0.0 / 0.0);

    System.out.println(Double.isNaN(double1));

}