11
私はこのような何かやりたい:KotlinでIntをLongに変換する方法?
fun process(minutes: Int) = 0
fun test() {
process(System.currentTimeMillis()/1000/60) // error: Int expected
}
を、私はprocess((System.currentTimeMillis()/1000/60) as Int)
をしようとした場合、私は、実行時にClassCastException
を取得します。
どのようにしてLongからIntに変換できますか?
あなたは[APIリファレンス]をスキャンすることができます(https://kotlinlang.org/api/latest/jvm/stdlib/index.html)、または経由クラスで利用可能な機能を探りますKotlinで役に立つものを見つけるためのIDEコード補完。 –