Байт
class Byte : Number, Comparable<Byte>
Для Common, JVM, JS
Представляет целое 8-битное знаковое число. На JVM значения этого типа без возможности null представлены как значения примитивного типа byte.
Для Native
Представляет целое 8-битное знаковое число.
Функции
compareTo
Сравнивает это значение с указанным значением для определения порядка. Возвращает ноль, если это значение равно указанному значению other, отрицательное число, если оно меньше other, или положительное число, если оно больше 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
dec
Возвращает это значение, уменьшенное на единицу.
operator fun dec(): Byte
div
Делит это значение на другое значение, округляя результат до ближайшего целого в сторону нуля.
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
equals
fun equals(other: Byte): Boolean
Указывает, является ли другой объект "равным" этому. Реализации должны удовлетворять следующим требованиям:
fun equals(other: Any?): Boolean
hashCode
Возвращает значение хэш-кода для объекта. Общий контракт для hashCode:
fun hashCode(): Int
inc
Возвращает это значение, увеличенное на единицу.
operator fun inc(): Byte
minus
Вычитает значение other из этого значения.
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
plus
Добавляет значение other к этому значению.
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
rangeTo
Создает диапазон от этого значения до указанного значения other.
operator fun rangeTo(other: Byte): IntRange
operator fun rangeTo(other: Short): IntRange
operator fun rangeTo(other: Int): IntRange
operator fun rangeTo(other: Long): LongRange
rem
Вычисляет остаток от целочисленного деления этого значения на другое значение.
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
times
Умножает это значение на другое значение.
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
toByte
Возвращает это значение.
fun toByte(): Byte
toDouble
toFloat
toInt
toLong
toShort
toString
Возвращает строковое представление объекта.
fun toString(): String
unaryMinus
Возвращает отрицательное значение.
operator fun unaryMinus(): Int
unaryPlus
Возвращает это значение.
operator fun unaryPlus(): Int
Свойства объекта-компаньона
MAX_VALUE
Константа, содержащая максимальное значение, которое может иметь экземпляр Byte.
const val MAX_VALUE: Byte
MIN_VALUE
Константа, содержащая минимальное значение, которое может иметь экземпляр Byte.
const val MIN_VALUE: Byte
SIZE_BITS
Количество бит, используемых для представления экземпляра Byte в двоичной форме.
const val SIZE_BITS: Int
SIZE_BYTES
Количество байтов, используемых для представления экземпляра Byte в двоичной форме.
const val SIZE_BYTES: Int
Расширяющие функции
and
Выполняет побитовую операцию И между двумя значениями.
infix fun Byte.and(other: Byte): Byte
coerceAtLeast
Обеспечивает, что это значение не меньше указанного минимального значения.
fun Byte.coerceAtLeast(minimumValue: Byte): Byte
fun <T : Comparable<T>> T.coerceAtLeast(minimumValue: T): T
coerceAtMost
Обеспечивает, что это значение не больше указанного максимального значения.
fun Byte.coerceAtMost(maximumValue: Byte): Byte
fun <T : Comparable<T>> T.coerceAtMost(maximumValue: T): T
coerceIn
Обеспечивает, что это значение находится в заданном диапазоне minimumValue..maximumValue.
fun Byte.coerceIn( minimumValue: Byte, maximumValue: Byte ): Byte
fun <T : Comparable<T>> T.coerceIn( minimumValue: T?, maximumValue: T? ): T
Обеспечивает, что это значение находится в заданном диапазоне.
fun <T : Comparable<T>> T.coerceIn( range: ClosedFloatingPointRange<T> ): T
fun <T : Comparable<T>> T.coerceIn(range: ClosedRange<T>): T
compareTo
convert
fun <R : Any> Byte.convert(): R
countLeadingZeroBits
Подсчитывает количество последовательных старших битов, которые равны нулю в двоичном представлении этого числа Byte.
fun Byte.countLeadingZeroBits(): Int
countOneBits
Подсчитывает количество установленных битов в двоичном представлении этого числа Byte.
fun Byte.countOneBits(): Int
countTrailingZeroBits
Подсчитывает количество последовательных младших битов, которые равны нулю в двоичном представлении этого числа Byte.
fun Byte.countTrailingZeroBits(): Int
downTo
Возвращает прогрессию от этого значения до указанного значения to со шагом -1.
infix fun Byte.downTo(to: Byte): IntProgression
infix fun Byte.downTo(to: Int): IntProgression
infix fun Byte.downTo(to: Long): LongProgression
infix fun Byte.downTo(to: Short): IntProgression
floorDiv
Делит это значение на другое значение, округляя результат до целого числа, которое ближе к отрицательной бесконечности.
fun Byte.floorDiv(other: Byte): Int
fun Byte.floorDiv(other: Short): Int
fun Byte.floorDiv(other: Int): Int
fun Byte.floorDiv(other: Long): Long
inv
Инвертирует биты в этом значении.
fun Byte.inv(): Byte
mod
Вычисляет остаток от целочисленного деления этого значения на другое значение.
fun Byte.mod(other: Byte): Byte
fun Byte.mod(other: Short): Short
fun Byte.mod(other: Int): Int
fun Byte.mod(other: Long): Long
narrow
fun <R : Number> Number.narrow(): R
or
Выполняет побитовую операцию ИЛИ между двумя значениями.
infix fun Byte.or(other: Byte): Byte
rangeTo
Создаёт диапазон от текущего значения Comparable до указанного значения that.
operator fun <T : Comparable<T>> T.rangeTo( that: T ): ClosedRange<T>
rangeUntil
Возвращает диапазон от текущего значения до, но не включая, указанное значение to.
operator fun Byte.rangeUntil(to: Byte): IntRange
operator fun Byte.rangeUntil(to: Int): IntRange
operator fun Byte.rangeUntil(to: Long): LongRange
operator fun Byte.rangeUntil(to: Short): IntRange
Создаёт открытый диапазон от текущего значения Comparable до указанного значения that , не включая его.
operator fun <T : Comparable<T>> T.rangeUntil( that: T ): OpenEndRange<T>
rotateLeft
rotateRight
signExtend
fun <R : Number> Number.signExtend(): R
takeHighestOneBit
Возвращает число, имеющее один бит, установленный в позиции самого значимого установленного бита этого числа Byte, или ноль, если это число равно нулю.
fun Byte.takeHighestOneBit(): Byte
takeLowestOneBit
Возвращает число, имеющее один бит, установленный в позиции наименее значимого установленного бита этого числа Byte, или ноль, если это число равно нулю.
fun Byte.takeLowestOneBit(): Byte
toBoolean
fun Byte.toBoolean(): Boolean
toUByte
toUInt
toULong
toUShort
until
Возвращает диапазон от текущего значения до, но не включая, указанное значение to.
infix fun Byte.until(to: Byte): IntRange
infix fun Byte.until(to: Int): IntRange
infix fun Byte.until(to: Long): LongRange
infix fun Byte.until(to: Short): IntRange
xor
Выполняет побитовую операцию XOR между двумя значениями.
infix fun Byte.xor(other: Byte): Byte
© 2010–2022 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/-byte/index.html