The java.util.Math.min method returns the minimum value between the given two arguments. This method accepts two parameters of any numeric data types, such as int, long, float, or double, and returns the smaller value.
Examples:
1. Finding the minimum value between two integers:
int a = 10; int b = 5; int min = Math.min(a, b); // returns 5
2. Finding the minimum value between two doubles:
double x = 3.14; double y = 2.71; double min = Math.min(x, y); // returns 2.71
This method is part of the java.util package library, which provides a collection of utility classes to perform common operations, such as mathematical functions, date and time calculations, and collection operations.
Java Math.min - 30 examples found. These are the top rated real world Java examples of java.util.Math.min extracted from open source projects. You can rate examples to help us improve the quality of examples.