ValueRange getLargestMinimum() method in Java with Examples
Last Updated :
27 Apr, 2023
The getLargestMinimum() method of ValueRange class is used to get the largest possible minimum value that the valueRange can take. For example, the ChronoField DAY_OF_WEEK always starts at 1. The largest minimum is therefore 1.
Syntax:
public long getLargestMinimum()
Parameters: This method accepts nothing.
Return value: This method returns the largest possible minimum value for this valueRange.
Below programs illustrate the ValueRange.getLargestMinimum() 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 Lmin = vR.getLargestMinimum();
System.out.println( "Largest Minimum "
+ "for DAY_OF_WEEK: " + Lmin);
}
}
|
Output:
Largest 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 Lmin = vRange.getLargestMinimum();
System.out.println( "Largest Minimum : " + Lmin);
}
}
|
Output:
Largest Minimum : 1111
Program 3:
Java
import java.io.*;
import java.time.LocalTime;
import java.time.temporal.ChronoField;
import java.time.temporal.ValueRange;
public class GFG {
public static void main(String[] args) {
LocalTime time = LocalTime.now();
ValueRange range = time.range(ChronoField.MINUTE_OF_HOUR);
long largestMin = range.getLargestMinimum();
System.out.println( "largest minimum for MINUTE_OF_HOUR : " + largestMin);
}
}
|
output :
largest minimum for MINUTE_OF_HOUR : 0
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...