Java BigDecimal Max max(BigDecimal... values)

Here you can find the source of max(BigDecimal... values)

Description

Finds maximum value from array of decimals.

License

Apache License

Parameter

Parameter Description
values BigDecimal[]

Declaration

public static BigDecimal max(BigDecimal... values) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;

public class Main {
    /**// w ww . ja  v a2s  . c  o  m
     * Finds maximum value from array of decimals. This method is null safe.
     * 
     * @param values
     *           {@Link BigDecimal[]}
     * @return
     */
    public static BigDecimal max(BigDecimal... values) {
        BigDecimal maxValue = null;
        if (values != null) {
            for (BigDecimal value : values) {
                if (maxValue == null || value != null && value.compareTo(maxValue) >= 0) {
                    maxValue = value;
                }
            }
        }
        return maxValue;
    }
}

Related

  1. max(BigDecimal a, BigDecimal b)
  2. max(BigDecimal b1, BigDecimal b2)
  3. max(BigDecimal one, BigDecimal other)
  4. max(BigDecimal... amounts)
  5. max(final BigDecimal bd1, final BigDecimal bd2)
  6. max(final List list)
  7. max(List numbers)
  8. maximum(BigDecimal... decimals)