Here you can find the source of toDouble(Object obj)
static Double toDouble(Object obj)
//package com.java2s; public class Main { static Double toDouble(Object obj) { if (obj instanceof String) return Double.valueOf((String) obj); if (obj instanceof Byte) { Byte b = (Byte) obj; return b.doubleValue(); }// www .j a v a 2 s. c om if (obj instanceof Short) { Short s = (Short) obj; return s.doubleValue(); } if (obj instanceof Integer) { Integer i = (Integer) obj; return i.doubleValue(); } if (obj instanceof Long) { Long l = (Long) obj; return l.doubleValue(); } if (obj instanceof Float) { Float f = (Float) obj; return f.doubleValue(); } return (Double) obj; } }