 <p>Note: For url-safe version of Base64 consider using modifyed set of characters for Base64 ( <a href="http://en.wikipedia.org/wiki/Base64#URL_applications" rel="nofollow">http://en.wikipedia.org/wiki/Base64#URL_applications</a>) instead of custom Base62.</p> <p>I believe you can append 0 to the array first (will make higest byte always not to contain 1 in the highest bit) and then convert to BigInteger if you really need positive BigInteger.</p>