convert double into int

前端 未结 1 789
野趣味
野趣味 2021-01-22 12:25

I have following double value: 8.943 need to convert(cast) into int e.g: 8.943*1000000 = 8943000 required value --> 894

相关标签:
1条回答
  • 2021-01-22 13:01
    double myDouble = 8.943
    int myInt = (int) (myDouble * 1000000)
    

    Using (int) casts the double into an int

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