Here you can find the source of sum(Integer... integers)
public static int sum(Integer... integers)
//package com.java2s; /**/*from w w w . j a va 2 s . c o m*/ * Copyright 2015 Jan Lolling jan.lolling@gmail.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class Main { /** * build the sum of given Integers regardless of null * * {Category} NumberUtil * * {talendTypes} int | Integer * * {param} int(2,5,99,120) integers: integers to sum. * * {example} sum(25,2,4,25,66) result: 8889 * */ public static int sum(Integer... integers) { int sum = 0; for (Integer i : integers) { if (i != null) { sum = sum + i.intValue(); } } return sum; } }