Here you can find the source of toDouble(Object value)
public static Double toDouble(Object value)
//package com.java2s; //License from project: Apache License public class Main { /**// ww w . j av a 2 s. com * Convert an Object to a Double. */ public static Double toDouble(Object value) { if (value == null) return null; if (value instanceof Double) return (Double) value; if (value instanceof String) { if ("".equals((String) value)) return null; return new Double((String) value); } if (value instanceof Number) return new Double(((Number) value).doubleValue()); return new Double(value.toString()); } /** * Convert an Object to a double, or 0 if it is null. */ public static double doubleValue(Object value) { if (value == null) return 0.0; return toDouble(value).doubleValue(); } }