Friday, February 6, 2026
HomeLanguagesJavaValueRange getMinimum() method in Java with Examples

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()

RELATED ARTICLES

Most Popular

Dominic
32489 POSTS0 COMMENTS
Milvus
126 POSTS0 COMMENTS
Nango Kala
6862 POSTS0 COMMENTS
Nicole Veronica
11983 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12073 POSTS0 COMMENTS
Shaida Kate Naidoo
6995 POSTS0 COMMENTS
Ted Musemwa
7236 POSTS0 COMMENTS
Thapelo Manthata
6946 POSTS0 COMMENTS
Umr Jansen
6930 POSTS0 COMMENTS