java – 如何使用输入大小修饰符打印一个长类型值?
发布时间:2020-12-14 16:30:50 所属栏目:Java 来源:网络整理
导读:这基本上是我想做的 // ... some code,calculations,what have you ...long timeToAdd = returnTimeToAddInLongFormat();// lets output the long type now,and yes i need the width and precision.System.out.printf("Time to add: %13.10ld",timeToAdd);
这基本上是我想做的
// ... some code,calculations,what have you ... long timeToAdd = returnTimeToAddInLongFormat(); // lets output the long type now,and yes i need the width and precision. System.out.printf("Time to add: %13.10ld",timeToAdd); 我已经阅读了关于这个主题的大部分google搜索,并且认为我理解如何在概念上做到这一点,但是JRE会给我一个UnknownFormatConversionException,并告诉我我的输入大小修改器l不工作. 还有另一种做法吗,还是想念小东西? 解决方法
Java将所有整数值视为d,没有ld.偶数字节和BigInteger是d类型.它也假定整数没有小数位.如果要显示10个零,则可以先转换为双倍,然后使用f
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |