I'm adding two hexadecimal numbers and return them as a String, How can i store the String value into int? it's not working with me. here's the code I'm working on.
the int A and B are not taking the String of num1 and num2 as int, how can i do it?
public static String Addtion(String num1, String num2){
int sum, carry=0;
int A = num1.length()-1;
int B = num2.length()-1;
String astn="";
if ( B < A && B!= A){
num2 = '0' + num2;
B++;
}
while(B>=0){
sum = (con(num1.charAt(A))+con(num2.charAt(B))+carry)%16;
carry= (con(num1.charAt(A))+con(num2.charAt(B))+carry)/16;
astn = toHexChar(sum) + astn;
A--;
B--;
}
return astn ;
}