📜  带有示例的 Scala Float toLong() 方法

📅  最后修改于: 2022-05-13 01:54:31.350000             🧑  作者: Mango

带有示例的 Scala Float toLong() 方法

toLong()方法用于将指定的数字转换为 Long 数据类型值。字节数据类型的范围是从-9、223、372、036、854、775、808到+9、223、372、036、854、775、807

示例 #1:

// Scala program of Float toLong()
// method
  
// Creating object
object GfG
{ 
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying toLong method
        val result = (5676).toLong
          
          
        // Displays output
        println(result)
      
    }
} 
输出:
5676

示例 #2:

// Scala program of Float toLong()
// method
  
// Creating object
object GfG
{ 
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying toLong method
        val result = (922365).toLong
          
          
        // Displays output
        println(result)
      
    }
} 
输出:
922365