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 ; } }
Get the sum of all input numbers