How to convert hexadecimal to decimal in Scala

1 Answer

0 votes
object HexToDecimal {
  def main(args: Array[String]): Unit = {
    val hex = "0x1D7F"
    val dec = Integer.parseInt(hex.substring(2), 16)

    println(dec)
  }
}



/*
run:

7551 
 
*/

 



answered Feb 14, 2025 by avibootz
...