java - How can I add hexadicimal numbers -


how can add following hex value using java method

a28904048e 

as

a2 + 89 + 04 + 04 + 8e 

to value 1c1

you way:

        string hashtwo="a28904048e";         long sum=0;         for(int i=0;i<hashtwo.length();i+=2){             sum+=integer.parseint(""+hashtwo.charat(i)+hashtwo.charat(i+1),16);         }         system.out.println(long.tohexstring(sum)); 

i hope helps.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -