Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想从double中删除小数点?
例如:234.567 将变为 234567。
您可以使用String.valueOf方法,然后.用空白字符("")替换。
String.valueOf
.
""
String s = String.valueOf(234.567).replace(".","");
使用简单的方法。将其转换为 int。:P
x =(浮点数)5.12;int a = (int) x; System.out.println(a);