1) the '~' inverts all the bits. Since a '4' is represented as
00000000 00000000 00000000 00000100
when you invert the bits you get
11111111 11111111 11111111 11111011
2) now you need to understand how java interprets this value. google or search this forum for "two's complement". basically, you look a the left-most digit, and if it's a 1, you know your value will be negative. you then invert all the digits and add one, so you get
which is 5. and we know our answer is negative, so "11111111 11111111 11111111 11111011" = -5.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com