Get the maximum of three float values in Java
Description
The following code shows how to get the maximum of three float values.
Example
// ww w. j av a 2 s. co m
public class Main {
public static float max(float a, float b, float c) {
return Math.max(Math.max(a, b), c);
}
public static void main(String[] argv) {
System.out.println(max(1.1f, 2.2f, 3.3f));
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »