On Tue, 7 Nov 2023 18:22:08 GMT, Roger Riggs <rri...@openjdk.org> wrote:
>> Raffaello Giulietti has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Using repeat() instead of loop. > > src/java.base/share/classes/java/math/BigDecimal.java line 3518: > >> 3516: for (int i = 0; i < trailingZeros; i++) { >> 3517: buf.append('0'); >> 3518: } > > A bit more compact as: > Suggestion: > > StringBuilder buf = new StringBuilder(len); > buf.append(str); > buf.repeat('0', trailingZeros); More compact and potentially faster. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16457#discussion_r1385435137