Open In App

Scala Int toHexString() method with example

Last Updated : 30 Jan, 2020
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
Report
The toHexString() method is utilized to return the hexa decimal form of the specified integer value.
Method Definition: def toHexString: String Return Type: It returns the Hexa decimal form of the specified integer value.
Example #1: Scala
// Scala program of Int toHexString()
// method 
  
// Creating object 
object GfG 
{  
  
    // Main method 
    def main(args:Array[String]) 
    { 
        // Applying toHexString() method  
        val result = (5).toHexString
          
        // Displays output 
        println(result) 
      
    } 
}  
Output:
5
Example #2: Scala
// Scala program of Int toHexString()
// method 
  
// Creating object 
object GfG 
{  
  
    // Main method 
    def main(args:Array[String]) 
    { 
        // Applying toHexString() method  
        val result = (18).toHexString
          
        // Displays output 
        println(result) 
      
    } 
}   
Output:
12

Article Tags :

Similar Reads