java - Are hexadecimal numbers ever negative? -


are hexadecimal numbers ever negative? if yes how?
binary have signed , unsigned.
how 1 represent them in hex? need hex routine embark upon.

yes. example you'd have following representations in signed 32-bit binary , hex:

decimal: 1  binary: 00000000 00000000 00000000 00000001     hex: 00 00 00 01  decimal: -1  binary: 11111111 11111111 11111111 11111111     hex: ff ff ff ff  decimal: -2  binary: 11111111 11111111 11111111 11111110     hex: ff ff ff fe 

as can see, hex representation of negative numbers directly related binary representation.


Comments