Find the min and max value betweent two integers in Java
Description
The following code shows how to find the min and max value betweent two integers.
Example
//ww w .j av a2s.co m
public class Main {
public static void main(String[] args) {
int a = 10;
int b = -50;
System.out.println("max(a, b) = " + Math.max(a, b));
System.out.println("min(a, b) = " + Math.min(a, b));
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »