Scala Int >>(x: Byte) 方法及示例

Scala Int >>(x: Byte) 方法及示例

使用 > >(x: Byte)方法将int值向右移位指定的字节数,并返回结果。

方法定义:(Int-Value).>>(Byte_Value)

返回类型:返回的值是int值向右移位指定的字节数的结果。

示例1:

// Scala program of Int >>(x: Byte)
// method

// Creating object
object GfG
{ 

// Main method
def main(args:Array[String])
{

    // Applying Int >>(x: Byte) function
    val result = (15).>>(2)

    // Displays output
    println(result)

}
} 
3

示例2:

// Scala program of Int >>(x: Byte)
// method

// Creating object
object GfG
{ 

// Main method
def main(args:Array[String])
{

    // Applying Int >>(x: Byte) function
    val result = (15).>>(3)

    // Displays output
    println(result)

}
} 
1

阅读更多:Scala 教程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程