class Int : Number, Comparable<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
.
infix fun and(other: Int): Int Performs a bitwise AND operation between the two values. | |
operator fun compareTo(other: Byte): Int operator fun compareTo(other: Short): Int operator fun compareTo(other: Int): Int operator fun compareTo(other: Long): Int operator fun compareTo(other: Float): Int operator fun compareTo(other: Double): 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 its less than other, or a positive number if its greater than other. | |
operator fun dec(): Int Decrements this value. | |
operator fun div(other: Byte): Int operator fun div(other: Short): Int operator fun div(other: Int): Int operator fun div(other: Long): Long operator fun div(other: Float): Float operator fun div(other: Double): Double Divides this value by the other value. | |
operator fun inc(): Int Increments this value. | |
fun inv(): Int Inverts the bits in this value. | |
operator fun minus(other: Byte): Int operator fun minus(other: Short): Int operator fun minus(other: Int): Int operator fun minus(other: Long): Long operator fun minus(other: Float): Float operator fun minus(other: Double): Double Subtracts the other value from this value. | |
infix fun or(other: Int): Int Performs a bitwise OR operation between the two values. | |
operator fun plus(other: Byte): Int operator fun plus(other: Short): Int operator fun plus(other: Int): Int operator fun plus(other: Long): Long operator fun plus(other: Float): Float operator fun plus(other: Double): Double Adds the other value to this value. | |
operator fun rangeTo(other: Byte): IntRange operator fun rangeTo(other: Short): IntRange operator fun rangeTo(other: Int): IntRange operator fun rangeTo(other: Long): LongRange Creates a range from this value to the specified other value. | |
operator fun rem(other: Byte): Int operator fun rem(other: Short): Int operator fun rem(other: Int): Int operator fun rem(other: Long): Long operator fun rem(other: Float): Float operator fun rem(other: Double): Double Calculates the remainder of dividing this value by the other value. | |
infix fun shl(bitCount: Int): Int Shifts this value left by bits. | |
infix fun shr(bitCount: Int): Int Shifts this value right by bits, filling the leftmost bits with copies of the sign bit. | |
operator fun times(other: Byte): Int operator fun times(other: Short): Int operator fun times(other: Int): Int operator fun times(other: Long): Long operator fun times(other: Float): Float operator fun times(other: Double): Double Multiplies this value by the other value. | |
fun toByte(): Byte Returns the value of this number as a Byte, which may involve rounding or truncation. | |
fun toChar(): Char Returns the Char with the numeric value equal to this number, truncated to 16 bits if appropriate. | |
fun toDouble(): Double Returns the value of this number as a Double, which may involve rounding. | |
fun toFloat(): Float Returns the value of this number as a Float, which may involve rounding. | |
fun toInt(): Int Returns the value of this number as an Int, which may involve rounding or truncation. | |
fun toLong(): Long Returns the value of this number as a Long, which may involve rounding or truncation. | |
fun toShort(): Short Returns the value of this number as a Short, which may involve rounding or truncation. | |
operator fun unaryMinus(): Int Returns the negative of this value. | |
operator fun unaryPlus(): Int Returns this value. | |
infix fun ushr(bitCount: Int): Int Shifts this value right by bits, filling the leftmost bits with zeros. | |
infix fun xor(other: Int): Int Performs a bitwise XOR operation between the two values. |
const val MAX_VALUE: Int A constant holding the maximum value an instance of Int can have. | |
const val MIN_VALUE: Int A constant holding the minimum value an instance of Int can have. |
fun Int.coerceAtLeast(minimumValue: Int): Int Ensures that this value is not less than the specified minimumValue. | |
fun Int.coerceAtMost(maximumValue: Int): Int Ensures that this value is not greater than the specified maximumValue. | |
fun Int.coerceIn(minimumValue: Int, maximumValue: Int): Int Ensures that this value lies in the specified range minimumValue..maximumValue. fun Int.coerceIn(range: ClosedRange<Int>): Int Ensures that this value lies in the specified range. | |
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. | |
fun Int.toString(radix: Int): String Returns a string representation of this Int value in the specified radix. | |
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. |
© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/