Int

Represents a 32-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type int.

Since Kotlin

1.1

Represents a 32-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type int.

Since Kotlin

1.0

Types

Link copied to clipboard
object Companion
Since Kotlin 1.1
object Companion
Since Kotlin 1.0

Functions

Link copied to clipboard
infix fun and(other: Int): Int

Performs a bitwise AND operation between the two values.

Since Kotlin 1.1
infix fun and(other: Int): Int

Performs a bitwise AND operation between the two values.

Since Kotlin 1.0
Link copied to clipboard
fun Int.coerceAtLeast(minimumValue: Int): Int

Ensures that this value is not less than the specified minimumValue.

Since Kotlin 1.0
Link copied to clipboard
fun Int.coerceAtMost(maximumValue: Int): Int

Ensures that this value is not greater than the specified maximumValue.

Since Kotlin 1.0
Link copied to clipboard

Ensures that this value lies in the specified range.

Since Kotlin 1.0
fun Int.coerceIn(minimumValue: Int, maximumValue: Int): Int

Ensures that this value lies in the specified range minimumValue..maximumValue.

Since Kotlin 1.0
Link copied to clipboard
operator fun compareTo(other: Byte): Int
operator fun compareTo(other: Double): Int
operator fun compareTo(other: Float): Int
open operator override fun compareTo(other: Int): Int
operator fun compareTo(other: Long): Int
operator fun compareTo(other: Short): Int

Compares this value with the specified value for order. Returns zero if this value is equal to the specified other value, a negative number if it's less than other, or a positive number if it's greater than other.

Since Kotlin 1.1
operator fun compareTo(other: Byte): Int
operator fun compareTo(other: Double): Int
operator fun compareTo(other: Float): Int
open operator override fun compareTo(other: Int): Int
operator fun compareTo(other: Long): Int
operator fun compareTo(other: Short): Int

Compares this value with the specified value for order. Returns zero if this value is equal to the specified other value, a negative number if it's less than other, or a positive number if it's greater than other.

Since Kotlin 1.0
Link copied to clipboard
operator fun dec(): Int

Returns this value decremented by one.

Since Kotlin 1.1
operator fun dec(): Int

Returns this value decremented by one.

Since Kotlin 1.0
Link copied to clipboard
operator fun div(other: Byte): Int
operator fun div(other: Int): Int
operator fun div(other: Long): Long
operator fun div(other: Short): Int

Divides this value by the other value, truncating the result to an integer that is closer to zero.

Since Kotlin 1.1
operator fun div(other: Double): Double
operator fun div(other: Float): Float

Divides this value by the other value.

Since Kotlin 1.1
operator fun div(other: Byte): Int
operator fun div(other: Int): Int
operator fun div(other: Long): Long
operator fun div(other: Short): Int

Divides this value by the other value, truncating the result to an integer that is closer to zero.

Since Kotlin 1.0
operator fun div(other: Double): Double
operator fun div(other: Float): Float

Divides this value by the other value.

Since Kotlin 1.0
Link copied to clipboard
infix fun Int.downTo(to: Byte): IntProgression
infix fun Int.downTo(to: Int): IntProgression
infix fun Int.downTo(to: Long): LongProgression
infix fun Int.downTo(to: Short): IntProgression

Returns a progression from this value down to the specified to value with the step -1.

Since Kotlin 1.0
Link copied to clipboard
operator fun inc(): Int

Returns this value incremented by one.

Since Kotlin 1.1
operator fun inc(): Int

Returns this value incremented by one.

Since Kotlin 1.0
Link copied to clipboard
fun inv(): Int

Inverts the bits in this value.

Since Kotlin 1.1
fun inv(): Int

Inverts the bits in this value.

Since Kotlin 1.0
Link copied to clipboard
operator fun minus(other: Byte): Int
operator fun minus(other: Double): Double
operator fun minus(other: Float): Float
operator fun minus(other: Int): Int
operator fun minus(other: Long): Long
operator fun minus(other: Short): Int

Subtracts the other value from this value.

Since Kotlin 1.1
operator fun minus(other: Byte): Int
operator fun minus(other: Double): Double
operator fun minus(other: Float): Float
operator fun minus(other: Int): Int
operator fun minus(other: Long): Long
operator fun minus(other: Short): Int

Subtracts the other value from this value.

Since Kotlin 1.0
Link copied to clipboard
infix fun or(other: Int): Int

Performs a bitwise OR operation between the two values.

Since Kotlin 1.1
infix fun or(other: Int): Int

Performs a bitwise OR operation between the two values.

Since Kotlin 1.0
Link copied to clipboard
operator fun plus(other: Byte): Int
operator fun plus(other: Double): Double
operator fun plus(other: Float): Float
operator fun plus(other: Int): Int
operator fun plus(other: Long): Long
operator fun plus(other: Short): Int

Adds the other value to this value.

Since Kotlin 1.1
operator fun plus(other: Byte): Int
operator fun plus(other: Double): Double
operator fun plus(other: Float): Float
operator fun plus(other: Int): Int
operator fun plus(other: Long): Long
operator fun plus(other: Short): Int

Adds the other value to this value.

Since Kotlin 1.0
Link copied to clipboard
operator fun rangeTo(other: Byte): IntRange
operator fun rangeTo(other: Int): IntRange
operator fun rangeTo(other: Long): LongRange
operator fun rangeTo(other: Short): IntRange

Creates a range from this value to the specified other value.

Since Kotlin 1.1
operator fun rangeTo(other: Byte): IntRange
operator fun rangeTo(other: Int): IntRange
operator fun rangeTo(other: Long): LongRange
operator fun rangeTo(other: Short): IntRange

Creates a range from this value to the specified other value.

Since Kotlin 1.0
Link copied to clipboard
operator fun rem(other: Byte): Int
operator fun rem(other: Double): Double
operator fun rem(other: Float): Float
operator fun rem(other: Int): Int
operator fun rem(other: Long): Long
operator fun rem(other: Short): Int

Calculates the remainder of truncating division of this value by the other value.

Since Kotlin 1.1
operator fun rem(other: Byte): Int
operator fun rem(other: Double): Double
operator fun rem(other: Float): Float
operator fun rem(other: Int): Int
operator fun rem(other: Long): Long
operator fun rem(other: Short): Int

Calculates the remainder of truncating division of this value by the other value.

Since Kotlin 1.1
Link copied to clipboard
infix fun shl(bitCount: Int): Int

Shifts this value left by the bitCount number of bits.

Since Kotlin 1.1
infix fun shl(bitCount: Int): Int

Shifts this value left by the bitCount number of bits.

Since Kotlin 1.0
Link copied to clipboard
infix fun shr(bitCount: Int): Int

Shifts this value right by the bitCount number of bits, filling the leftmost bits with copies of the sign bit.

Since Kotlin 1.1
infix fun shr(bitCount: Int): Int

Shifts this value right by the bitCount number of bits, filling the leftmost bits with copies of the sign bit.

Since Kotlin 1.0
Link copied to clipboard
operator fun times(other: Byte): Int
operator fun times(other: Double): Double
operator fun times(other: Float): Float
operator fun times(other: Int): Int
operator fun times(other: Long): Long
operator fun times(other: Short): Int

Multiplies this value by the other value.

Since Kotlin 1.1
operator fun times(other: Byte): Int
operator fun times(other: Double): Double
operator fun times(other: Float): Float
operator fun times(other: Int): Int
operator fun times(other: Long): Long
operator fun times(other: Short): Int

Multiplies this value by the other value.

Since Kotlin 1.0
Link copied to clipboard
open override fun toByte(): Byte

Converts this Int value to Byte.

Since Kotlin 1.1
open override fun toByte(): Byte

Converts this Int value to Byte.

Since Kotlin 1.0
Link copied to clipboard
open override fun toChar(): Char

Converts this Int value to Char.

Since Kotlin 1.1
open override fun toChar(): Char

Converts this Int value to Char.

Since Kotlin 1.0
Link copied to clipboard
open override fun toDouble(): Double

Converts this Int value to Double.

Since Kotlin 1.1
open override fun toDouble(): Double

Converts this Int value to Double.

Since Kotlin 1.0
Link copied to clipboard
open override fun toFloat(): Float

Converts this Int value to Float.

Since Kotlin 1.1
open override fun toFloat(): Float

Converts this Int value to Float.

Since Kotlin 1.0
Link copied to clipboard
open override fun toInt(): Int

Returns this value.

Since Kotlin 1.1
open override fun toInt(): Int

Returns this value.

Since Kotlin 1.0
Link copied to clipboard
open override fun toLong(): Long

Converts this Int value to Long.

Since Kotlin 1.1
open override fun toLong(): Long

Converts this Int value to Long.

Since Kotlin 1.0
Link copied to clipboard
open override fun toShort(): Short

Converts this Int value to Short.

Since Kotlin 1.1
open override fun toShort(): Short

Converts this Int value to Short.

Since Kotlin 1.0
Link copied to clipboard
expect inline fun Int.toString(radix: Int): String

Returns a string representation of this Int value in the specified radix.

Since Kotlin 1.1
Link copied to clipboard
operator fun unaryMinus(): Int

Returns the negative of this value.

Since Kotlin 1.1
operator fun unaryMinus(): Int

Returns the negative of this value.

Since Kotlin 1.0
Link copied to clipboard
operator fun unaryPlus(): Int

Returns this value.

Since Kotlin 1.1
operator fun unaryPlus(): Int

Returns this value.

Since Kotlin 1.0
Link copied to clipboard
infix fun Int.until(to: Byte): IntRange
infix fun Int.until(to: Int): IntRange
infix fun Int.until(to: Long): LongRange
infix fun Int.until(to: Short): IntRange

Returns a range from this value up to but excluding the specified to value.

Since Kotlin 1.0
Link copied to clipboard
infix fun ushr(bitCount: Int): Int

Shifts this value right by the bitCount number of bits, filling the leftmost bits with zeros.

Since Kotlin 1.1
infix fun ushr(bitCount: Int): Int

Shifts this value right by the bitCount number of bits, filling the leftmost bits with zeros.

Since Kotlin 1.0
Link copied to clipboard
infix fun xor(other: Int): Int

Performs a bitwise XOR operation between the two values.

Since Kotlin 1.1
infix fun xor(other: Int): Int

Performs a bitwise XOR operation between the two values.

Since Kotlin 1.0