Here you can find the source of add(float... values)
Parameter | Description |
---|---|
values | the given values |
public static float add(float... values)
//package com.java2s; /**// w w w. j a v a 2 s . c o m * AADL-Utils * * Copyright ? 2012 TELECOM ParisTech and CNRS * * TELECOM ParisTech/LTCI * * Authors: see AUTHORS * * This program is free software: you can redistribute it and/or modify * it under the terms of the Eclipse Public License as published by Eclipse, * either version 1.0 of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * Eclipse Public License for more details. * You should have received a copy of the Eclipse Public License * along with this program. If not, see * http://www.eclipse.org/org/documents/epl-v10.php */ import java.math.BigDecimal; public class Main { /** * Sums the given float values. * * @param values the given values * @return the sum */ public static float add(float... values) { BigDecimal res = new BigDecimal("0"); for (float f : values) { BigDecimal bf = new BigDecimal(f + ""); res = res.add(bf); } return res.floatValue(); } }