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.
在某些服务器上,我的服务是用 java 编写的:
Long bufValue = ((LocalDateTime) fieldValue).toDateTime().getMillis(); value = bufValue.toString();// value = 1.377216E12
以指数符号格式返回字符串,例如 1.377216E12 克服此问题的最佳方法是什么?
你可以使用String.format-
String.format
String.format("%d", value);
或者-
value = Double.valueOf(bufValue.toString()).longValue();
DecimalFormat formatter = new DecimalFormat("0"); value = formatter.format(bufValue);