here goes:
take the positive counterpart of your negative number, then convert it to binary. Finally inverts all bits (0 to 1 and 1 to 0) and add 1.
Example:
Negative number: -145
Positive number: 145
Binary of 145: 00000000 00000000 00000000 10010001
invert all bits: 11111111 11111111 11111111 01101110
add 1: 11111111 11111111 11111111 01101111
the last binary sequence is actually the binary representation of -145
HIH
------------------
Valentin Crettaz
Sun Certified Programmer for
Java 2 Platform
[This message has been edited by Valentin Crettaz (edited December 18, 2001).]