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