On Thu, 18 Jul 2024 15:43:05 GMT, Shaojin Wen <d...@openjdk.org> wrote:

>> 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:
> 
>   copyright

The extraction of string length logic to `DecimalDigits` look great.

-------------

Marked as reviewed by liach (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20232#pullrequestreview-2186450502

Reply via email to