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:MainClass.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:DateNumberSample.java

public static void main(String args[]) {
    Double kb = new Double(3.5);
    Date today = new Date();

    String pattern = "{0}K was deleted on {1}.";
    Object[] arguments = { kb, today };
    System.out.println(MessageFormat.format(pattern, arguments));
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    Object[] params = new Object[] { new Double(123.45), new Double(1234.56) };
    String msg = MessageFormat.format("{0,number,currency} a''s and {1,number,currency} b''s", params);
    System.out.println(msg);/*from ww w.  ja v a 2  s. c  o  m*/

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    Object[] params = new Object[] { new Double(123.45), new Double(1234.56) };
    String msg = MessageFormat.format("{0,number,percent} a''s and {1,number,percent} b''s", params);

    System.out.println(msg);//  w ww.j  av  a 2 s. c  o m

}

From source file:Main.java

public static void main(String[] args) {
    Class cls = Long.class;

    Long l = new Long(8);
    Double d = new Double(3.5);

    // checking for Long instance
    boolean retval = cls.isInstance(l);
    System.out.println(l + " is Long ? " + retval);

    // checking for Long instance
    retval = cls.isInstance(d);//from w  ww .j av a  2  s .  com
    System.out.println(d + " is Long ? " + retval);
}

From source file:Main.java

public static void main(String[] args) {

    Function<Integer, Double> centToFahrenheitInt = x -> new Double((x * 9 / 5) + 32);
    double fahrenheit = centToFahrenheitInt.apply(100);
    System.out.println("Centigrade to Fahrenheit: " + fahrenheit);
}

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    Double kb = new Double(3.5);
    Date today = new Date();

    String pattern = "{0}K was deleted on {1}.";
    Object[] arguments = { kb, today };
    System.out.println(MessageFormat.format(pattern, arguments));
}

From source file:MainClass.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) {
    Vector<Double> v = new Vector<Double>();
    v.add(new Double("3.4"));
    v.add(new Double("3.3"));
    v.add(new Double("4.4"));
    v.add(new Double("5.3"));
    v.add(new Double("3.3"));
    Object obj = Collections.min(v);
    System.out.println(obj);/*from   www .j a  v  a  2  s  . c  o m*/
}

From source file:Main.java

public static void main(String[] args) {

    Vector<Double> v = new Vector<Double>();

    v.add(new Double("3.4324"));
    v.add(new Double("3.3532"));
    v.add(new Double("3.342"));
    v.add(new Double("3.349"));
    v.add(new Double("2.3"));

    Object obj = Collections.max(v);
    System.out.println(obj);//w  w  w.  j av a  2  s  . c  o  m
}