Java tutorial
//package com.java2s; public class Main { public static double parseDouble(String str, double defaultValue) { double i = defaultValue; if (str != null && !str.equals("")) { try { i = Double.parseDouble(str); } catch (NumberFormatException e) { // TODO Auto-generated catch block i = defaultValue; } } return i; } public static double parseDouble(String str) { return parseDouble(str, 0); } }