Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static double tryParseDouble(String text, double def) { double ret = 0.0; try { ret = Double.parseDouble(text); } catch (Exception e) { ret = def; } return ret; } }