Java Number Add add(Double... ds)

Here you can find the source of add(Double... ds)

Description

add

License

Apache License

Declaration

private static double add(Double... ds) 

Method Source Code

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

import java.math.BigDecimal;

public class Main {
    private static double add(Double... ds) {
        BigDecimal bigD = new BigDecimal("0");
        for (int i = 0; i < ds.length; i++) {
            if (ds[i] != null)
                bigD = bigD.add(new BigDecimal(Double.toString(ds[i])));
        }/* w w w .jav a2  s.c  om*/
        //return bigD.divide(new BigDecimal(1), 2, BigDecimal.ROUND_HALF_UP).doubleValue();
        return bigD.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
    }
}

Related

  1. add(Double v1, Double v2)
  2. add(Double v1, Double v2)
  3. add(double v1, double v2)
  4. add(double v1, double v2)
  5. add(double... ds)
  6. add(final Number a, final Number b)
  7. add(final String start, final String... values)
  8. add(float... values)
  9. add(float[] param)