BigInteger.toString method is deleting leading 0
问题 I am trying to generate MD5 sum using MessageDigest. And i am having following code. byte[] md5sum = digest.digest(); BigInteger bigInt = new BigInteger(1, md5sum); output = bigInt.toString(16); This returns not 32 character string but a 31 character string 8611c0b0832bce5a19ceee626a403a7 Expected String is 08611c0b0832bce5a19ceee626a403a7 Leading 0 is missing in the output. I tried the other method byte[] md5sum = digest.digest(); output = new String(Hex.encodeHex(md5sum)); And the output is