Here you can find the source of toDouble(Object val)
public static Double toDouble(Object val)
//package com.java2s; //License from project: Apache License public class Main { public static Double toDouble(Object val) { if (val == null) { return 0D; }//ww w . j a va2 s . co m try { return Double.valueOf(trim(val.toString())); } catch (Exception e) { return 0D; } } public static String trim(String str) { return (null == str) ? null : str.trim(); } }