Java Math.max(float a, float b)
Syntax
Math.max(float a, float b) has the following syntax.
public static float max(float a, float b)
Example
In the following code shows how to use Math.max(float a, float b) method.
/*from w ww .jav a 2 s . c o m*/
public class Main {
public static void main(String[] args) {
// get two float numbers
float x = 12345.6f;
float y = 1234f;
// print the larger number between x and y
System.out.println("Math.max(" + x + "," + y + ")=" + Math.max(x, y));
}
}
The code above generates the following result.