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
import java.time.LocalDateTime;
import java.time.temporal.ChronoField;
import java.time.temporal.ValueRange;
public class GFG {
public static void main(String[] args)
{
LocalDateTime l1
= LocalDateTime
.parse(" 2018 - 12 -06T19: 21 : 12 ");
ValueRange vR
= l1.range(ChronoField.DAY_OF_WEEK);
long min = vR.getMinimum();
System.out.println("Minimum for DAY_OF_WEEK: "
+ min);
}
}
|
Output:
Minimum for DAY_OF_WEEK: 1
Program 2:
Java
import java.time.temporal.ValueRange;
public class GFG {
public static void main(String[] args)
{
ValueRange vRange = ValueRange.of( 1111 , 99999 );
long min = vRange.getMinimum();
System.out.println("Minimum : "
+ min);
}
}
|
References: https://docs.oracle.com/javase/10/docs/api/java/time/temporal/ValueRange.html#getMinimum()
Last Updated :
19 Apr, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...