public static BigDecimal maximum ( BigDecimal ... values ) { int len = values . length ; if ( len == 1 ) { if ( values [ 0 ] == null ) { throw new IllegalArgumentException ( "Cannot passed null BigDecimal entry to maximum()" ) ; } return values [ 0 ] ; } BigDecimal current = values [ 0 ] ; for ( int i = 1 ; i < len ; i ++ ) { if ( values [ i ] == null ) { throw new IllegalArgumentException ( "Cannot passed null BigDecimal entry to maximum()" ) ; } current = values [ i ] . max ( current ) ; } return current ; }
Calculate the maximum value from an array of values .