Scala Float toLong() method with example

The toLong() method is utilized to convert the specified number into Long data type value. The range of the byte data type is from -9, 223, 372, 036, 854, 775, 808 to +9, 223, 372, 036, 854, 775, 807

Method Definition: (Number).toLong
Return Type: It returns the converted Long datatype value.

Example #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)
      
    }


Output:

5676

Example #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)
      
    }


Output:

922365