While we're here.
On 8/20/19 1:05 AM, Aleksey Shipilev wrote:
*) This might be "static final", while we are at it:
4109 private static String[] zeros = new String[64];
It may make sense to create the only string as
private static final String zeros = "0".repeat(63);
and then replace all
sb.append(zeros[x]) with sb.append(zeros, 0, x) and
sb.insert(pos, zeros[x]) with sb.insert(pos, zeros, 0, x).
The difference would be in one extra bounds check, and as both append()
and insert() are relatively expensive, this check would hardly be
noticeable.
--
With kind regards,
Ivan Gerasimov