masmic masmic - 1 year ago 211
Android Question

android int to hex converting

I have to convert an int to an hex value. This is for example the int value:

int_value = -13516;

To convert to a hex value i do:

hex_value = Integer.toHexString(int_value);

The value that I should get is :
(I don't know if i should make it positive).

The thing is that doing the conversion that way, the value that I get is:
ffff cb34

Can't I use this function to make this conversion?

Answer Source

Documentation says Integer.toHexString returns the hexadecimal representation of the int as an unsigned value.

I believe Integer.toString(value, 16) will accomplish what you want.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download