Scala Int byteValue() 方法与示例
byteValue()方法用于返回指定 int 值的字节值。
Method Definition: def byteValue(): Byte
Return Type: It returns the byte value of the given int value.
示例 #1:
// Scala program of Int byteValue
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying byteValue method
val result = (15).byteValue
// Displays output
println(result)
}
}
输出:
15
示例 #2:
// Scala program of Int byteValue
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying byteValue method
val result = (1586).byteValue
// Displays output
println(result)
}
}
输出:
50