ValueRange isIntValue() method in Java with Examples
Last Updated :
29 Jan, 2020
The isIntValue() method of ValueRange class is used to check if all values in the ValueRange fit in an int. This method validates that all valid values are within the bounds of an integer or not.
Syntax:
public boolean isIntValue()
Parameters: This method accepts nothing.
Return value: This method returns true if a valid value always fits in an int.
Below programs illustrate the ValueRange.isIntValue() method:
Program 1:
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_MONTH);
boolean response = vR.isIntValue();
System.out.println( "isIntValue: "
+ response);
}
}
|
Program 2:
import java.time.temporal.ValueRange;
public class GFG {
public static void main(String[] args)
{
ValueRange vRange = ValueRange.of( 1111 , 66666 );
boolean response = vRange.isIntValue();
System.out.println( "isIntValue: "
+ response);
}
}
|
References: https://docs.oracle.com/javase/10/docs/api/java/time/temporal/ValueRange.html#isIntValue()
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...