Motivation: I would like to convert hashes (MD5/SHA1 etc) into decimal integers for the purpose of making barcodes in Code128C. For simplicity, I prefer al
Examining the documentation for the relevant BigInteger constructor, we see:
The individual bytes in the value array should be in little-endian order, from lowest-order byte to highest-order byte
[...]
The constructor expects positive values in the byte array to use sign-and-magnitude representation, and negative values to use two's complement representation. In other words, if the highest-order bit of the highest-order byte in value is set, the resulting BigInteger value is negative. Depending on the source of the byte array, this may cause a positive value to be misinterpreted as a negative value.
[...]
To prevent positive values from being misinterpreted as negative values, you can add a zero-byte value to the end of the array.