Here you can find the source of toDouble(Object ob, Double defaultDouble)
public static Double toDouble(Object ob, Double defaultDouble)
//package com.java2s; public class Main { public static Double toDouble(Object ob, Double defaultDouble) { if (ob == null) { return defaultDouble; }//ww w . j a va 2 s . c o m if (ob instanceof Integer) { return ((Integer) ob).doubleValue(); } else if (ob instanceof Float) { return ((Float) ob).doubleValue(); } else if (ob instanceof Double) { return ((Double) ob).doubleValue(); } else if (ob instanceof Byte) { return ((Byte) ob).doubleValue(); } else { try { return new Double(ob.toString()); } catch (Exception e) { return defaultDouble; } } } public static Double toDouble(Object ob) { return toDouble(ob, 0d); } }