Guava’s Ints.min() returns the least value present in array.
public static int min(int... array)
Parameters: This method takes the array as parameter which is a nonempty array of int values.
Return Value: This method returns the value present in array that is lesser than or equal to every other value in the array.
Exceptions: The method throws IllegalArgumentException if array is empty.
Below examples illustrates the Ints.min() method:
Minimum Value is: -5
Example 2: To demonstrate IllegalArgumentException
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.