Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This compliant solution assumes that the unsigned integer has 32 bits. It reads in an unsigned integer value into a long variable using the readInt() method. If the read integer is unsigned, the most significant bit may be turned on. Consequently, all the higher order bits of the resulting long are set because of sign extension, and these must be masked off as demonstrated. The For other integer sizes, the mask size must should vary depending on the size of the unsigned integer.

...