Get the sum of all input numbers

Any numeric string recognized by {@code BigDecimal} is supported.

@param addends one or more valid number strings

@return <code>addends[0] + addends[1] + ...</code>

@see BigDecimal
543931
public static String sum(String... addends) {

        if (addends == null || addends.length == 0) {
            return null;
        }

        BigDecimal sum;
        try {
            sum = new BigDecimal(addends[0]);
            for (int i = 1; i < addends.length; i++) {
                sum = sum.add(new BigDecimal(addends[i]));
            }
            return sum.toString();
        } catch (Exception e) {
            return null;
        }
    }
1101197
static Integer numerator(final String s) {
        if ("".equals(s)) {
            return null;
        }
        String[] tokens = s.split("/");
        return emptyToNullInteger(tokens[0]);
    }
219315
public void add(double addend) {  
        for (int c = 0; c < this.values.length; c++) {
            addValue(c, addend);
        }
    }
932363
void add(MutableBigInteger addend) {
        int x = intLen;
        int y = addend.intLen;
        int resultLen = (intLen > addend.intLen ? intLen : addend.intLen);
        int[] result = (value.length < resultLen ? new int[resultLen] : value);

        int rstart = result.length-1;
        long sum;
        long carry = 0;

        // Add common parts of both numbers
        while(x > 0 && y > 0) {
            x--; y--;
            sum = (value[x+offset] & LONG_MASK) +
                (addend.value[y+addend.offset] & LONG_MASK) + carry;
            result[rstart--] = (int)sum;
            carry = sum >>> 32;
        }

        // Add remainder of the longer number
        while(x > 0) {
            x--;
            if (carry == 0 && result == value && rstart == (x + offset))
                return;
            sum = (value[x+offset] & LONG_MASK) + carry;
            result[rstart--] = (int)sum;
            carry = sum >>> 32;
        }
        while(y > 0) {
            y--;
            sum = (addend.value[y+addend.offset] & LONG_MASK) + carry;
            result[rstart--] = (int)sum;
            carry = sum >>> 32;
        }

        if (carry > 0) { // Result must grow in length
            resultLen++;
            if (result.length < resultLen) {
                int temp[] = new int[resultLen];
                // Result one word longer from carry-out; copy low-order
                // bits into new result.
                System.arraycopy(result, 0, temp, 1, result.length);
                temp[0] = 1;
                result = temp;
            } else {
                result[rstart--] = 1;
            }
        }

        value = result;
        intLen = resultLen;
        offset = result.length - resultLen;
    }
1148318
@InterfaceAudience.Public
    public static double totalValues(List<Object> values) {
        double total = 0;
        for (Object object : values) {
            if (object instanceof Number) {
                Number number = (Number) object;
                total += number.doubleValue();
            } else {
                Log.w(Log.TAG_VIEW, "Warning non-numeric value found in totalValues: %s", object);
            }
        }
        return total;
    }
268921
public static float sum (float zero, Iterable<? extends Number> values)
    {
        for (Number value : values) {
            zero += value.floatValue();
        }
        return zero;
    }
740261
public static Long sum(Iterable<Integer> values) {
    long ret = 0;
    for (final int x : values) {
      ret += x;
    }
    return ret;
  }
353464
public PackedDecimal add(BigDecimal summand) {
        BigDecimal summe = toBigDecimal().add(summand);
        return PackedDecimal.valueOf(summe);
    }
721588
public PackedDecimal add(PackedDecimal summand) {
        if (this.isBruch() || summand.isBruch()) {
            return add(summand.toBruch());
        } else {
            return add(summand.toBigDecimal());
        }
    }
1065401
public BigDecimal getIdPartAsBigDecimal() {
    String val = getIdPart();
    if (isBlank(val)) {
      return null;
    }
    return new BigDecimal(val);
  }
586117
public static int sum(int[] x) {
        double sum = 0.0;

        for (int n : x) {
            sum += n;
        }

        if (sum > Integer.MAX_VALUE || sum < -Integer.MAX_VALUE) {
            throw new ArithmeticException("Sum overflow: " + sum);
        }
        
        return (int) sum;
    }
204110
public ValueList appendNumberSet(BigDecimal ... val) {
        super.append(new LinkedHashSet<BigDecimal>(Arrays.asList(val)));
        return this;
    }
375364
public static <N extends Number> Number sum(List<N> numberList) {
        return cal(numberList,
                doubleStream -> OptionalDouble.of(doubleStream.sum()));
    }
817337
@Override
    public BigDecimalAttribute plus(BigDecimalAttribute attribute)
    {
        return (BigDecimalAttribute) MappedAttributeUtil.plus(this, (NumericAttribute) attribute);
    }
1290452
public DigitBuffer append(String s) {
    int len = s.length();
    check(len);
    for (int i = 0; i < len; i++) {
      this.buf[size] = s.charAt(i);
      size++;
    }
    return this;
  }
456204
public static float Sum(float[] data) {
        float sum = 0;
        for (int i = 0; i < data.length; i++) {
            sum += data[i];
        }
        return sum;
    }
525602
public final String format(java.math.BigDecimal number) {
        return format(number, new StringBuffer(),
                      new FieldPosition(0)).toString();
    }