Here you can find the source of parseDouble(final String text)
public static double parseDouble(final String text) throws NumberFormatException
//package com.java2s; import java.util.regex.Pattern; public class Main { private static final Pattern DOUBLE_INFINITY = Pattern.compile("-?inf(inity)?", Pattern.CASE_INSENSITIVE); /**//from www . j av a 2 s . c o m * If the next token is a double and return its value. * Otherwise, throw a {@link NumberFormatException}. */ public static double parseDouble(final String text) throws NumberFormatException { // We need to parse infinity and nan separately because // Double.parseDouble() does not accept "inf", "infinity", or "nan". if (DOUBLE_INFINITY.matcher(text).matches()) { final boolean negative = text.startsWith("-"); return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; } if (text.equalsIgnoreCase("nan")) { return Double.NaN; } final double result = Double.parseDouble(text); return result; } }