Here you can find the source of toDouble(String str)
public static double toDouble(String str)
//package com.java2s; //License from project: Mozilla Public License public class Main { public static double toDouble(String str) { return toDouble(str, 0.0d); }//from w ww . j av a 2s .c om public static double toDouble(String str, double defaultValue) { if (str == null) { return defaultValue; } try { return Double.parseDouble(str); } catch (NumberFormatException nfe) { return defaultValue; } } }