Closed guilhermeblanco closed 4 years ago
Hm... I think I made a mistake. Give me some time to inspect the length calculation, this part seems inaccurate. The other part for left-padding zero is correct though. =)
Hi Guilherme,
Thanks for the input! 😃 (And sorry for the late comment, I was busy during the last couple of weeks.)
The estimated output length was only meant to initialise the ByteArrayOutputStream
with a sensible capacity. I'm not sure if padding with zeroes to the estimatedOutputLength
is correct. What are your thoughts on this?
Also: out
is reversed before being returned, so it essentially is already left-padded.
This implementation is kept very close to https://github.com/tuupola/base62, since I've used Mika's approach to Base 62 encoding as a reference. So far it produces the same outputs as the PHP library and I'd rather not change anything that isn't broken.