Java Double Number Create toDouble(Number value)

Here you can find the source of toDouble(Number value)

Description

to Double

License

Open Source License

Declaration

public static Double toDouble(Number value) 

Method Source Code

//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();
        }
    }
}

Related

  1. toDouble(int[] array)
  2. toDouble(int[] rgb)
  3. toDouble(int[][] arr)
  4. toDouble(Number n)
  5. toDouble(Number number)
  6. toDouble(Number value)
  7. toDouble(Object _inStrObj)
  8. toDouble(Object _value, double _default)
  9. toDouble(Object argSource)