String hex="7D";
		System.out.println(hexToDecimal(hex));
	}
	public static int hexToDecimal(String hex){
		int sum=0;int k=0;
		for(int i=hex.length()-1;i>=0;i--,k++){
			char temp=hex.charAt(i);
			if(temp>='A'&&temp<='F'){
				int calc=temp-'A'+10;
				sum+=calc*Math.pow(16, k);
			}
			else sum+=hex.charAt(i)*Math.pow(16, k);
 
		}
	return sum;
	}
why the sum output is:893 and not 125?

--- Update ---

nvm i understood:]
i should do temp-'0' as temp is char!