Here you can find the source of coerceToDouble(Object o)
public static double coerceToDouble(Object o)
//package com.java2s; // Released under the Apache License, Version 2.0 public class Main { public static double coerceToDouble(Object o) { if (o instanceof Number) { return ((Number) o).doubleValue(); } else {/*from w ww.ja v a2 s .c o m*/ try { return Double.parseDouble(o.toString()); } catch (NumberFormatException e) { return Double.NaN; } } } }