> class LocalTime { > public String toString() { > // ... > if (nanoValue % 1000_000 == 0) { > buf.append(Integer.toString((nanoValue / 1000_000) + > 1000).substring(1)); > } else if (nanoValue % 1000 == 0) { > buf.append(Integer.toString((nanoValue / 1000) + > 1000_000).substring(1)); > } else { > buf.append(Integer.toString((nanoValue) + > 1000_000_000).substring(1)); > } > // ... > } > } > > Currently, LocalTime.toString handles nanos by adding a value and then > subString(1) to fill it with zeros. Using StringBuilder.repeat is more > concise and has better performance.
Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: breaking on every 3 digits ------------- Changes: - all: https://git.openjdk.org/jdk/pull/20232/files - new: https://git.openjdk.org/jdk/pull/20232/files/ac302761..be7daa68 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=20232&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=20232&range=01-02 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/20232.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/20232/head:pull/20232 PR: https://git.openjdk.org/jdk/pull/20232