[英]How to assign int number to double after decimal
Assume we have int x = 4
and I want to assign x
as a digit after the decimal in the following double number: 假设我们有int x = 4
并且我想将x
分配为以下双精度数中小数点后的数字:
double value = 2.x;
so the value
should be 2.4
因此该value
应为2.4
How can I do that in Java? 如何用Java做到这一点?
一个简单的方程式应该有所帮助
double value = 2 + x / 10.0;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.