Java Utililty Methods Double Number Create

List of utility methods to do Double Number Create

Description

The list of methods to do Double Number Create are organized into topic(s).

Method

DoubletoDouble(Object o)
to Double
Double result = null;
if (o instanceof Double) {
    result = (Double) o;
} else if (o instanceof String) {
    result = Double.parseDouble((String) o);
} else if (o instanceof Integer) {
    result = new Double((Integer) o);
return result;
DoubletoDouble(Object o)
to Double
if (o == null) {
    return null;
return Double.valueOf(String.valueOf(o));
doubletoDouble(Object o)
to Double
if (o instanceof Integer)
    return new Double(((Integer) o).intValue());
if (o instanceof Double)
    return ((Double) o);
if (o instanceof String) {
    try {
        return new Double(Double.parseDouble((String) o));
    } catch (NumberFormatException ex) {
...
DoubletoDouble(Object o)
Attempts to cast an arbitrary object to a Double.
if (o instanceof Double) {
    return (Double) o;
} else {
    return Double.valueOf(o.toString());
DoubletoDouble(Object o)
to Double
if (o == null)
    return null;
if (o.getClass() == Double.class)
    return (Double) o;
if (o.getClass() == Boolean.class)
    return booleanToDouble((Boolean) o);
if (o.getClass() == Byte.class)
    return (double) ((Byte) o).byteValue();
...
DoubletoDouble(Object ob, Double defaultDouble)
to Double
if (ob == null) {
    return defaultDouble;
if (ob instanceof Integer) {
    return ((Integer) ob).doubleValue();
} else if (ob instanceof Float) {
    return ((Float) ob).doubleValue();
} else if (ob instanceof Double) {
...
doubletoDouble(Object obj)
Get the double value of this object, only if the object is an instance of Number
return (obj instanceof Number) ? ((Number) obj).doubleValue() : 0.0d;
doubletoDouble(Object obj)
This method convert object to Double.
double value = 0;
if (obj != null) {
    value = ((Double) obj).doubleValue();
return value;
doubletoDouble(Object obj)
to Double
if (obj instanceof Integer) {
    return ((Integer) obj).doubleValue();
if (obj instanceof Double) {
    return ((Double) obj).doubleValue();
if (obj instanceof Long) {
    return ((Long) obj).doubleValue();
...
doubletoDouble(Object obj)
to Double
String str = obj != null ? obj.toString().trim() : "";
return "".equals(str) ? 0.00 : Double.parseDouble(str);