Here you can find the source of toDouble(Number value)
public static Double toDouble(Number value)
//package com.java2s; //License from project: Open Source License public class Main { public static Double toDouble(Number value) { if (value == null) { return null; } else if (value instanceof Float) { //TODO to be improved //using doubleValue can lead to a wrong representation of the floating point number //but even to string cannot be used when the precision is too high... String strValue = value.toString(); return new Double(strValue); } else {/*from w w w.j av a 2s . co m*/ return value.doubleValue(); } } }