ValueRange getMinimum() method in Java with Examples

The getMinimum() method of ValueRange class is used to get the minimum value that the valueRange can take. For example, the ChronoField DAY_OF_WEEK always starts at 1. The minimum is therefore 1.Â
Syntax:
public long getMinimum()
Parameters: This method accepts nothing.Â
Return value: This method returns the minimum value for this valueRange.Â
Below programs illustrate the ValueRange.getMinimum() method:Â
Program 1:Â
Java
// Java program to demonstrate// ValueRange.getMinimum() methodÂ
import java.time.LocalDateTime;import java.time.temporal.ChronoField;import java.time.temporal.ValueRange;Â
public class GFG {Â Â Â Â public static void main(String[] args)Â Â Â Â {Â
        // create LocalDateTime        LocalDateTime l1            = LocalDateTime                  .parse("2018-12-06T19:21:12");Â
        // Get ValueRange object        ValueRange vR            = l1.range(ChronoField.DAY_OF_WEEK);Â
        // apply getMinimum()        long min = vR.getMinimum();Â
        // print results        System.out.println("Minimum for DAY_OF_WEEK: "                           + min);    }} |
Output:
Minimum for DAY_OF_WEEK: 1
Program 2:Â
Java
// Java program to demonstrate// ValueRange.getMinimum() methodÂ
import java.time.temporal.ValueRange;Â
public class GFG {Â Â Â Â public static void main(String[] args)Â Â Â Â {Â
        // create ValueRange object        ValueRange vRange = ValueRange.of(1111, 99999);Â
        // get minimum        long min = vRange.getMinimum();Â
        // print results        System.out.println("Minimum : "                           + min);    }} |
Output:
Minimum : 1111
References: https://docs.oracle.com/javase/10/docs/api/java/time/temporal/ValueRange.html#getMinimum()



