Here you can find the source of toDouble(String value, Double defaultValue)
public static Double toDouble(String value, Double defaultValue)
//package com.java2s; //License from project: Open Source License public class Main { public static Double toDouble(String value, Double defaultValue) { if (isEmpty(value)) return defaultValue; try {//from www .ja v a2s . c om return Double.parseDouble(value); } catch (Exception e) { return defaultValue; } } public static boolean isEmpty(String str) { if (str == null) return true; if ("".equals(str.trim())) return true; return false; } }