How to declare a byte array in Scala?

前端 未结 7 1270
心在旅途
心在旅途 2020-12-23 21:22

In Scala, I can declare a byte array this way

val ipaddr: Array[Byte] = Array(192.toByte, 168.toByte, 1.toByte, 9.toByte)

This is too verbo

相关标签:
7条回答
  • 2020-12-23 22:18

    How about Array(192, 168, 1, 1).map(_.toByte)?

    0 讨论(0)
提交回复
热议问题