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); } } |
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); } } |
Minimum : 1111
References: https://docs.oracle.com/javase/10/docs/api/java/time/temporal/ValueRange.html#getMinimum()