Here you can find the source of toDouble(String s)
public static double toDouble(String s)
//package com.java2s; public class Main { public static double toDouble(String s) { double i = 0; try {//from w w w . j av a 2 s . c om i = Double.parseDouble(s); } catch (Exception e) { i = -1; } return i; } }