c++ equivalent unsigned atithmetic in java -


i'm trying convert c++ snippet java. simple. have byte input value -121. there routine converts unsigned integer , converts string using base 16 , "ffffffffffffff87"

i not sure how same string in java. have tried

byte b = -121; int ival = integer.max_value + b + 1; string str = integer.tostring(ival, 16); // prints "7fffff87" 

how can same string c++ ?

you want long.tohexstring(b). returns ffffffffffffff87 when b -121.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -