class Short : Number, Comparable<Short>
Represents a 16-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type short
.
Represents a 16-bit signed integer.
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.
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
Decrements this value.
operator fun dec(): Short
Divides this value by the other 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
fun equals(other: Short): Boolean
Indicates whether some other object is "equal to" this one. Implementations must fulfil the following requirements:
fun equals(other: Any?): Boolean
Returns a hash code value for the object. The general contract of hashCode
is:
fun hashCode(): Int
Increments this value.
operator fun inc(): Short
Subtracts the other value from 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
Adds the other value to this value.
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
Creates a range from this value to the specified other 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
Calculates the remainder of dividing this value by the 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
Multiplies this value by the other value.
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
Returns this value.
fun toShort(): Short
Returns a string representation of the object.
fun toString(): String
Returns the negative of this value.
operator fun unaryMinus(): Int
Returns this value.
operator fun unaryPlus(): Int
A constant holding the maximum value an instance of Short can have.
const val MAX_VALUE: Short
A constant holding the minimum value an instance of Short can have.
const val MIN_VALUE: Short
The number of bits used to represent an instance of Short in a binary form.
const val SIZE_BITS: Int
The number of bytes used to represent an instance of Short in a binary form.
const val SIZE_BYTES: Int
Performs a bitwise AND operation between the two values.
infix fun Short.and(other: Short): Short
Ensures that this value is not less than the specified minimumValue.
fun Short.coerceAtLeast(minimumValue: Short): Short
fun <T : Comparable<T>> T.coerceAtLeast(minimumValue: T): T
Ensures that this value is not greater than the specified maximumValue.
fun Short.coerceAtMost(maximumValue: Short): Short
fun <T : Comparable<T>> T.coerceAtMost(maximumValue: T): T
Ensures that this value lies in the specified range minimumValue..maximumValue.
fun Short.coerceIn( minimumValue: Short, maximumValue: Short ): Short
fun <T : Comparable<T>> T.coerceIn( minimumValue: T?, maximumValue: T? ): T
Ensures that this value lies in the specified range.
fun <T : Comparable<T>> T.coerceIn( range: ClosedFloatingPointRange<T> ): T
fun <T : Comparable<T>> T.coerceIn(range: ClosedRange<T>): T
fun <R : Any> Short.convert(): R
Counts the number of consecutive most significant bits that are zero in the binary representation of this Short number.
fun Short.countLeadingZeroBits(): Int
Counts the number of set bits in the binary representation of this Short number.
fun Short.countOneBits(): Int
Counts the number of consecutive least significant bits that are zero in the binary representation of this Short number.
fun Short.countTrailingZeroBits(): Int
Returns a progression from this value down to the specified to value with the step -1.
infix fun Short.downTo(to: Byte): IntProgression
infix fun Short.downTo(to: Int): IntProgression
infix fun Short.downTo(to: Long): LongProgression
infix fun Short.downTo(to: Short): IntProgression
Inverts the bits in this value.
fun Short.inv(): Short
fun <R : Number> Number.narrow(): R
Performs a bitwise OR operation between the two values.
infix fun Short.or(other: Short): Short
Creates a range from this Comparable value to the specified that value.
operator fun <T : Comparable<T>> T.rangeTo( that: T ): ClosedRange<T>
fun <R : Number> Number.signExtend(): R
Returns a number having a single bit set in the position of the most significant set bit of this Short number, or zero, if this number is zero.
fun Short.takeHighestOneBit(): Short
Returns a number having a single bit set in the position of the least significant set bit of this Short number, or zero, if this number is zero.
fun Short.takeLowestOneBit(): Short
Returns a range from this value up to but excluding the specified to value.
infix fun Short.until(to: Byte): IntRange
infix fun Short.until(to: Int): IntRange
infix fun Short.until(to: Long): LongRange
infix fun Short.until(to: Short): IntRange
Performs a bitwise XOR operation between the two values.
infix fun Short.xor(other: Short): Short
© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-short/index.html