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