List of usage examples for java.lang Double Double
@Deprecated(since = "9") public Double(String s) throws NumberFormatException
From source file:Main.java
public static void main(String[] args) { double d = Math.sqrt(-10); boolean b1 = Double.isNaN(d); System.out.println(b1);/*from w ww .ja va2s. c o m*/ Double dObj = new Double(d); boolean b2 = dObj.isNaN(); System.out.println(b2); }
From source file:Main.java
public static void main(String[] args) { // get a number as float Number x = new Float(123456f); // get a number as double Number y = new Double(9876); // print their value as int System.out.println("x as float:" + x + ", x as Integer:" + x.intValue()); System.out.println("y as double:" + y + ", y as Integer:" + y.intValue()); }
From source file:Main.java
public static void main(String[] args) { // get a number as float Number x = new Float(123456f); // get a number as double Number y = new Double(9876); // print their value as short System.out.println("x as float :" + x + ", x as short:" + x.shortValue()); System.out.println("y as double:" + y + ", y as short:" + y.shortValue()); }
From source file:Main.java
public static void main(String[] args) { // get a number as float Number x = new Float(123456f); // get a number as double Number y = new Double(9876); // print their value as long System.out.println("x as float:" + x + ", x as long:" + x.longValue()); System.out.println("y as double:" + y + ", y as long:" + y.longValue()); }
From source file:Main.java
public static void main(String[] args) { double d = (double) 4 / 0; boolean b1 = Double.isInfinite(d); System.out.println(b1);/*from ww w . jav a2 s . c o m*/ Double dObj = new Double(d); boolean b2 = dObj.isInfinite(); System.out.println(b2); }
From source file:Main.java
public static void main(String[] args) { // get a number as integer Number x = new Integer(123456); // get a number as double Number y = new Double(9876); // print their value as float System.out.println("x as integer:" + x + ", x as float:" + x.floatValue()); System.out.println("y as double:" + y + ", y as float:" + y.floatValue()); }
From source file:MyClass.java
public static void main(String args[]) { MyClass raw = new MyClass(new Double(98.6)); double d = (Double) raw.getob(); System.out.println("value: " + d); }
From source file:TreeMapDemo.java
public static void main(String args[]) { TreeMap<String, Double> tm = new TreeMap<String, Double>(); tm.put("A", new Double(3.34)); tm.put("B", new Double(1.22)); tm.put("C", new Double(1.00)); tm.put("D", new Double(9.22)); tm.put("E", new Double(-1.08)); Set<Map.Entry<String, Double>> set = tm.entrySet(); for (Map.Entry<String, Double> me : set) { System.out.print(me.getKey() + ": "); System.out.println(me.getValue()); }// w ww.ja va 2 s . c o m double balance = tm.get("A"); tm.put("B", balance + 1000); System.out.println(tm.get("A")); }
From source file:HashMapDemo.java
public static void main(String args[]) { HashMap<String, Double> hm = new HashMap<String, Double>(); hm.put("A", new Double(3.34)); hm.put("B", new Double(1.22)); hm.put("C", new Double(1.00)); hm.put("D", new Double(9.22)); hm.put("E", new Double(-19.08)); Set<Map.Entry<String, Double>> set = hm.entrySet(); for (Map.Entry<String, Double> me : set) { System.out.print(me.getKey() + ": "); System.out.println(me.getValue()); }/* w ww . ja v a 2s . c o m*/ double balance = hm.get("A"); hm.put("A", balance + 1000); System.out.println(hm.get("A")); }
From source file:MainClass.java
public static void main(String args[]) { Vector v = new Vector(); for (int i = 0; i < 5; i++) { v.addElement(new Double(5)); }/* w w w .ja va 2 s.c o m*/ for (int i = v.size() - 1; i >= 0; i--) { System.out.print(v.elementAt(i) + " "); } }