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(final Object obj)
to Double
try {
    if (obj instanceof String) {
        return Double.valueOf((String) obj).doubleValue();
    } else if (obj instanceof Number) {
        return ((Number) obj).doubleValue();
    } else {
        throw new IllegalArgumentException("Could not convert value to number: " + obj);
} catch (Exception e) {
    throw new IllegalArgumentException("Could not convert value to number: " + obj, e);
doubletoDouble(final Object value)
To double.
if (value == null) {
    return 0;
return new Double(value.toString());
DoubletoDouble(final Object valueRep)
to Double
return Double.parseDouble(String.valueOf(valueRep));
doubletoDouble(final String argStr)
to Double
double ret = Double.NaN;
try {
    ret = Double.valueOf(argStr);
} catch (NumberFormatException nfE) {
return ret;
DoubletoDouble(final String value)
Converts a String to a double plus if the String is NULL, the returned value will be NULL.
if (value == null) {
    return null;
return Double.valueOf(value);
doubletoDouble(final String value)
To double.
if (value == null) {
    return 0.0D;
String szTemp = "";
for (int i = 0; i < value.length(); i++)
    if (value.charAt(i) != ',') {
        szTemp = szTemp + value.charAt(i);
try {
    final double d = Double.parseDouble(szTemp);
    return d;
} catch (final NumberFormatException e) {
    final double d1 = 0.0D;
    return d1;
doubletoDouble(float in1)
to Double
return (double) in1;
double[]toDouble(float[] a)
Convert the input array to a double
if (a == null)
    return null;
double[] b = new double[a.length];
for (int i = 0; i < a.length; i++)
    b[i] = a[i];
return b;
double[]toDouble(float[] a)
to Double
double[] re = new double[a.length];
for (int i = 0; i < re.length; i++)
    re[i] = (double) a[i];
return re;
double[]toDouble(float[] array)
to Double
int n = array.length;
double[] a2 = new double[n];
for (int i = 0; i < n; i++) {
    a2[i] = array[i];
return a2;