Long

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

Since Kotlin

1.0

Types

Link copied to clipboard
object Companion
Since Kotlin 1.0

Properties

Link copied to clipboard
expect val Long.absoluteValue: Long

Returns the absolute value of this value.

Since Kotlin 1.2
actual val Long.absoluteValue: Long

Returns the absolute value of this value.

Since Kotlin 1.2
actual val Long.absoluteValue: Long

Returns the absolute value of this value.

Since Kotlin 1.2
Link copied to clipboard
expect val Long.sign: Int

Returns the sign of this value:

Since Kotlin 1.2
actual val Long.sign: Int

Returns the sign of this value:

Since Kotlin 1.2
actual val Long.sign: Int

Returns the sign of this value:

Since Kotlin 1.2

Functions

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

Performs a bitwise AND operation between the two values.

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

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

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

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 Long.coerceIn(minimumValue: Long, maximumValue: Long): Long

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
operator fun compareTo(other: Int): Int
open operator override 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(): Long

Returns this value decremented by one.

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

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 Long.downTo(to: Int): LongProgression

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(): Long

Returns this value incremented by one.

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

Inverts the bits in this value.

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

Subtracts the other value from this value.

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

Performs a bitwise OR operation between the two values.

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

Adds the other value to this value.

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

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

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

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): Long

Shifts this value left by the bitCount number of bits.

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

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): Long
operator fun times(other: Double): Double
operator fun times(other: Float): Float
operator fun times(other: Int): Long
operator fun times(other: Long): Long
operator fun times(other: Short): Long

Multiplies this value by the other value.

Since Kotlin 1.0
Link copied to clipboard
inline fun Long.toBigDecimal(mathContext: MathContext): BigDecimal

Returns the value of this Long number as a BigDecimal.

Since Kotlin 1.2
Link copied to clipboard

Returns the value of this Long number as a BigInteger.

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

Converts this Long value to Byte.

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

Converts this Long value to Char.

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

Converts this Long value to Double.

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

Converts this Long value to Float.

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

Converts this Long value to Int.

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

Returns this value.

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

Converts this Long value to Short.

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

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

Since Kotlin 1.2
actual fun Long.toString(radix: Int): String

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

Since Kotlin 1.2
actual inline fun Long.toString(radix: Int): String

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

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

Returns the negative of this value.

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

Returns this value.

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

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): Long

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: Long): Long

Performs a bitwise XOR operation between the two values.

Since Kotlin 1.0