Java Object to Double objectToDouble(Object o)

Here you can find the source of objectToDouble(Object o)

Description

object To Double

License

Apache License

Declaration

public static final double objectToDouble(Object o) 

Method Source Code

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

public class Main {
    public static final double objectToDouble(Object o) {
        if (o instanceof Number)
            return ((Number) o).doubleValue();
        try {/*from w w  w .jav  a 2s. c  om*/
            if (o == null)
                return -1D;
            else
                return Double.parseDouble(o.toString());
        } catch (NumberFormatException e) {
            return -1D;
        }
    }
}

Related

  1. castToDoubleArray(byte[] data)
  2. castToDoubleArray(Object[] array)
  3. castToDoubles(final int[] ints)
  4. objectToDouble(Object o)
  5. objectToDouble(Object o)
  6. objectToDouble(Object obj)
  7. objectToDouble(Object obj)
  8. objectToDouble(Object Obj)
  9. objectToDouble(Object p1)