Java Double Number From toDoubleByObject(Object obj)

Here you can find the source of toDoubleByObject(Object obj)

Description

to Double By Object

License

Apache License

Declaration

public static Double toDoubleByObject(Object obj) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static Double toDoubleByObject(Object obj) {
        try {//from ww  w.j  a va 2s .  c om
            return Double.valueOf(toStringByObject(obj, true));
        } catch (Exception e) {
            return 0.0d;
        }
    }

    public static String toStringByObject(Object obj) {
        return toStringByObject(obj, false);
    }

    public static String toStringByObject(Object obj, boolean isqdkg) {
        if (obj == null) {
            return "";
        } else {
            if (isqdkg) {
                return obj.toString().trim();
            } else {
                return obj.toString();
            }

        }
    }
}

Related

  1. toDoubleAsUnsigned(long v)
  2. toDoubleDigit(int number)
  3. toDoubleMatrix(Number[][] matrix)
  4. toDoubleObject(Object obj)
  5. toDoublePow10(long m, int n)