Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-07-17 UTC.
[null,null,["Last updated 2025-07-17 UTC."],[],[],null,["# IntRange\n========\n\nArtifact: [androidx.annotation:annotation](/jetpack/androidx/releases/annotation) \n[View Source](https://cs.android.com/search?q=file:androidx/annotation/IntRange.kt+class:androidx.annotation.IntRange) \nAdded in [1.0.0](/jetpack/androidx/releases/annotation#1.0.0)\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/androidx/annotation/IntRange \"View this page in Java\")\nCommon/AllAndroid/JVMNative/C/iOS\n - Cmn \n\n ```\n @MustBeDocumented\n @Retention(value = AnnotationRetention.BINARY)\n @Target(allowedTargets = [AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FIELD, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.ANNOTATION_CLASS])\n annotation IntRange\n ```\n\n*** ** * ** ***\n\nDenotes that the annotated element should be an int or long in the given range.\n\nExample: \n\n```kotlin\n@IntRange(from=0,to=255)\npublic int getAlpha() {\n ...\n}\n```\n\nSummary\n-------\n\n| ### Public constructors |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|\n| [IntRange](/reference/kotlin/androidx/annotation/IntRange#IntRange(kotlin.Long,kotlin.Long))`(from: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`, to: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` | Cmn |\n\n| ### Public properties |\n|-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|-----|\n| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | [from](/reference/kotlin/androidx/annotation/IntRange#from()) Smallest value, inclusive | Cmn |\n| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | [to](/reference/kotlin/androidx/annotation/IntRange#to()) Largest value, inclusive | Cmn |\n\nPublic constructors\n-------------------\n\n### IntRange\n\nCmn \n\n```\nIntRange(from: Long = Long.MIN_VALUE, to: Long = Long.MAX_VALUE)\n```\n\nPublic properties\n-----------------\n\n### from\n\nCmn \n\n```\nval from: Long\n```\n\nSmallest value, inclusive \n\n### to\n\nCmn \n\n```\nval to: Long\n```\n\nLargest value, inclusive"]]