On Thu, 30 Jun 2022 16:24:05 GMT, Naoto Sato <na...@openjdk.org> wrote:

>> In this case, I would suggest to use straight number.
>> 
>> If you notice, the lengths are listed as {0} KB, {0} MB, {0} GB (there are 
>> no terabytes, I see), and "1023 bytes" would make the string too long and 
>> might case ellipses to appear.
>> 
>> Also, the threshold might be set at <= 999 instead of 1024.  The reason is 
>> group separator - the user might prefer to see 1,023 instead of 1023.
>> 
>> Ideally, there should be a pluggable policy (formatter) to format the 
>> lengths to the user's liking.
>> 
>> To summarize,
>> 0...999 -> "0" ... "999"
>> 1000 ... 1023 -> "1 KB"
>
> Another option is to use `java.text.CompactNumberFormat` which can handle 
> those K/M/B suffixes nicely.

Would java.text.CompactNumberFormat work for java 8?

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

PR: https://git.openjdk.org/jdk/pull/9327

Reply via email to