android - Java convert 16 bits signed to 4 digits hex -


when dealing signed int conversion hex, integer.tostring(value, 16) useful

see a post on subject need format 4 hex digits (leading zeros positive numbers , not 32bits/8chars negatif numbers),

in c++ right function inttohex( value,4) http://docwiki.embarcadero.com/libraries/xe3/en/system.sysutils.inttohex

but didn't fiund equivalent in java (android).

found :

int stepref =-2; string ss = string.format("%08x",stepref); string ss4 = ss.substring(ss.length() - 4); 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -