How to encode a ByteArray to a base36 String

341 views Asked by At

To encode a ByteArray to Base64 I could simply use Base64 from java.util. But now I need to change my code to create base36 instead. Unfortunately java.util doesn't have this functionality. What I need is a function/method that takes a ByteArray and outputs a String containing a base36 representation of it. No other changes like cutting off leading zeroes.

So this other question looks similar but we're are 2 problems. First the question got edited so that I don't understand the answer. Second, the answer uses BigInteger and I'm afraid that converting the ByteArray to a BigInteger could lead to information loss (like leading zeroes). Similar question on stackoverflow.

0

There are 0 answers