Skip to content

Commit

Permalink
Update Formatter zero padding
Browse files Browse the repository at this point in the history
  • Loading branch information
chadrako committed Feb 27, 2024
1 parent b9ccb2f commit 8b1b6c5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jdk/src/share/classes/java/util/Formatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -4381,8 +4381,9 @@ private char getZero(Locale l) {
// apply zero padding
len = sb.length();
if (width > len && f.contains(Flags.ZERO_PAD)) {
String zeros = new String(new char[width - len]).replace("\0", "0");
sb.insert(begin, zeros);
char[] zeros = new char[width - len];
Arrays.fill(zeros, zero);
sb.insert(begin, new String(zeros));
}

return sb;
Expand Down

0 comments on commit 8b1b6c5

Please sign in to comment.