java - Adding hexadecimal numbers with a truncated result -


i need in java regarding memory location addition.

if current memory location @ fffffff8 , there offset of +10, in java value of 100000008 if want value 0000 0000 0000 0008 instead of 0000 0001 0000 0008, how should go doing , current code doing calculation optimized?

currently code using followed:

long = long.parselong("fffffff8",16) + long.parselong("10",16); string x = long.tohexstring(a); 

since appears want 32-bit math, why using long in first place?

if use int, want:

int = 0xfffffff8 + 0x10; 

will give 8.

and thomas said, unless you're being handed strings somwhere there no need use long.parselong() or integer.parseint() since can write numeric literals directly in hex form.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -