ValueRange getLargestMinimum() method in Java with Examples

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

// Java program to demonstrate
// ValueRange.getLargestMinimum() 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 getLargestMinimum()
        long Lmin = vR.getLargestMinimum();
  
        // print results
        System.out.println("Largest Minimum "
                           + "for DAY_OF_WEEK: "
                           + Lmin);
    }
}

chevron_right


Output:

Largest Minimum for DAY_OF_WEEK: 1

Program 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

// Java program to demonstrate
// ValueRange.getLargestMinimum() 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 Largest minimum
        long Lmin = vRange.getLargestMinimum();
  
        // print results
        System.out.println("Largest Minimum : "
                           + Lmin);
    }
}

chevron_right


Output:

Largest Minimum : 1111

References: https://docs.oracle.com/javase/10/docs/api/java/time/temporal/ValueRange.html#getLargestMinimum()

java-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.