Gets the minimum of three long values in Java
Description
The following code shows how to gets the minimum of three long values.
Example
/*from w w w . j a v a 2 s .c om*/
public class Main {
public static long minimum(long a, long b, long c) {
if (b < a) {
a = b;
}
if (c < a) {
a = c;
}
return a;
}
public static void main(String[] argv){
System.out.println(minimum(1,2,3));
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »