Gets the maximum of three long values in Java
Description
The following code shows how to gets the maximum of three long values.
Example
/* w w w . j av a 2s. c om*/
public class Main {
public static long max(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(max(1,2,3));
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »