8335645: j.u.Formatter#trailingZeros improved with String repeat

Reviewed-by: liach, jlu, naoto
This commit is contained in:
Shaojin Wen 2024-07-05 12:50:09 +00:00 committed by Chen Liang
parent c8acea87e2
commit 194425d787

View File

@ -4249,8 +4249,8 @@ public final class Formatter implements Closeable, Flushable {
// Add trailing zeros
private void trailingZeros(StringBuilder sb, int nzeros) {
for (int i = 0; i < nzeros; i++) {
sb.append('0');
if (nzeros > 0) {
sb.repeat('0', nzeros);
}
}