< prev index next >
src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
Print this page
rev 16194 : imported patch XXXXXXX-Use-StringBuilder-appendN-method
*** 2707,2718 ****
throw new DateTimeException("Field " + field +
" cannot be printed as the value " + value +
" cannot be negative according to the SignStyle");
}
}
! for (int i = 0; i < minWidth - str.length(); i++) {
! buf.append(decimalStyle.getZeroDigit());
}
buf.append(str);
return true;
}
--- 2707,2718 ----
throw new DateTimeException("Field " + field +
" cannot be printed as the value " + value +
" cannot be negative according to the SignStyle");
}
}
! if (minWidth > str.length()) {
! buf.appendN(decimalStyle.getZeroDigit(), minWidth - str.length());
}
buf.append(str);
return true;
}
*** 3124,3136 ****
if (fraction.scale() == 0) { // scale is zero if value is zero
if (minWidth > 0) {
if (decimalPoint) {
buf.append(decimalStyle.getDecimalSeparator());
}
! for (int i = 0; i < minWidth; i++) {
! buf.append(decimalStyle.getZeroDigit());
! }
}
} else {
int outputScale = Math.min(Math.max(fraction.scale(), minWidth), maxWidth);
fraction = fraction.setScale(outputScale, RoundingMode.FLOOR);
String str = fraction.toPlainString().substring(2);
--- 3124,3134 ----
if (fraction.scale() == 0) { // scale is zero if value is zero
if (minWidth > 0) {
if (decimalPoint) {
buf.append(decimalStyle.getDecimalSeparator());
}
! buf.appendN(decimalStyle.getZeroDigit(), minWidth);
}
} else {
int outputScale = Math.min(Math.max(fraction.scale(), minWidth), maxWidth);
fraction = fraction.setScale(outputScale, RoundingMode.FLOOR);
String str = fraction.toPlainString().substring(2);
< prev index next >