On Fri, 16 Sep 2022 08:31:19 GMT, KIRIYAMA Takuya <[email protected]> wrote:
>> test/jdk/tools/launcher/I18NArgTest.java line 147:
>>
>>> 145: for (int i = 0; i < sysPropVal.length(); i++) {
>>> 146: sysPropHexVal =
>>> sysPropHexVal.concat(Integer.toHexString(sysPropVal.charAt(i)));
>>> 147: }
>>
>> It's OK as it stands, but this loop could be replaced with a `HexFormat`
>> one-liner.
>
> I'm sorry, I can't replace this code with a HexFormat one-line. Do you have
> an example code?
Extract to a byte array with the appropriate charset and then HexFormat the
bytearray.
var SysPropHexVal =
HexFormat.of().formatHex(sysPropVal.getBytes(StandardCharsets.UTF_16));
-------------
PR: https://git.openjdk.org/jdk/pull/9389