Java Number Add add(Double a, Double b)

Here you can find the source of add(Double a, Double b)

Description

add

License

Open Source License

Declaration

public static Double add(Double a, Double b) throws Exception 

Method Source Code


//package com.java2s;
import java.math.BigDecimal;

public class Main {
    /**//from  w ww . ja v  a2s  . co  m
     * Double add
     * @param a
     * @param b
     * @return
     * @Create Sin@2012/2/23
     */
    public static BigDecimal add(String a, String b) {
        BigDecimal bd1 = new BigDecimal(a);
        BigDecimal bd2 = new BigDecimal(b);
        return bd1.add(bd2);
    }

    public static Double add(Double a, Double b) throws Exception {
        BigDecimal bd1 = new BigDecimal(a.toString());
        BigDecimal bd2 = new BigDecimal(b.toString());
        return bd1.add(bd2).doubleValue();
    }
}

Related

  1. add(double a, double b)
  2. add(Double v1, Double v2)
  3. add(double v1, double v2)
  4. add(double v1, double v2)
  5. add(Double v1, Double v2)