Open In App

Scala Float toLong() method with example

Last Updated : 03 Nov, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads