📜  Scala Int byteValue() 方法与示例

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

Scala Int byteValue() 方法与示例

byteValue()方法用于返回指定 int 值的字节值。

示例 #1:

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

示例 #2:

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