Java Double Number Create toDouble(Object objValue)

Here you can find the source of toDouble(Object objValue)

Description

to Double

License

Open Source License

Parameter

Parameter Description
objValue Object

Return

double

Declaration

public static double toDouble(Object objValue) 

Method Source Code

//package com.java2s;
/*//from   ww  w. jav  a  2  s.  co m
 * Copyright 2005-2020 GreenTube Team All rights reserved.
 * Support: Huxg
 * License: CND team license
 */

public class Main {
    /**
     *
     *
     * @param objValue Object
     *
     * @return double
     */
    public static double toDouble(Object objValue) {
        if (objValue != null) {
            if (objValue instanceof Number) {
                return ((Number) objValue).doubleValue();
            } else {
                return Double.parseDouble(objValue.toString());
            }
        } else
            return 0;
    }

    /**
     * 
     *
     * @param objValue Object
     *
     * @return String
     */
    public static String toString(Object objValue) {
        if (objValue != null)
            return objValue.toString();
        else
            return null;
    }
}

Related

  1. toDouble(Object obj)
  2. toDouble(Object obj)
  3. toDouble(Object object)
  4. toDouble(Object object, double defaultValue)
  5. toDouble(Object object, Double defaultValue)
  6. toDouble(Object prmIntObject)
  7. toDouble(Object val)
  8. toDouble(Object val)
  9. toDouble(Object val)