Home » Java BigDecimal max() method with Examples

Java BigDecimal max() method with Examples

by Online Tutorials Library

Java BigDecimal max() method

The max() method of java BigDecimal class is used to obtain a maximum value between BigDecimal and val.

Syntax:

Parameter:

Val: value with which the maximum is to be computed.

Exception:

No

Returns:

It returns maximum value between two BigDecimal values. In case if both are equal, first BigDecimal will be returned.

Example 1

Test it Now

Output:

Max Value among 152207 and 152208 is = 152208  

Example 2

Test it Now

Output:

Max Value among -55 and -44 is = -44  

Example 3

Test it Now

Output:

Max Value among 145 and 145 is = 145  

Example 4

Test it Now

Output:

Max Value among 678.4008 and 678.4009 is = 678.4009  

Next TopicJava BigDecimal

You may also like