This can happen if the byte order is not specified correctly. For example, if you have a little-endian byte order but specify big-endian when converting to an integer, the output will be different than expected.