Retrieve the maximum value from various pairs of numbers.
System. |
Definition and UsageThe max() method retrieves the number with the highest value from a pair of numbers.
Tip: To obtain the number with the lowest value, you can utilize the min() method.
One of the following:
public static double max(double x, double y)
|
public static float max(float x, float y)
|
public static int max(int x, int y)
|
public static long max(longx, long y)
|
Parameter |
Description |
x |
Mandatory. A numerical value is expected. |
y |
Mandatory. A numerical value is expected. |
Returns: |
A double, float, int, or long value representing the larger of two numbers. |
Java Version: |
Any |