How do I format a long integer as a string without separator in Java?

寵の児 提交于 2019-11-29 20:54:29
Rob H
MessageFormat.format("{0,number,#}", foo);

The shortest way is

long foo = 12345;
String s = ""+foo;

As an alternative String.format and java.util.Formatter might work for you as well...

You could try:

String s = new Long(foo).toString();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!