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
Post a Comment