You need to provide the conversion method Integer.parseInt(String s, int radix)
with a radix, (which is 16 for Hex), so you need to change this line
asciiCode = Integer.parseInt(codeArray[indexC]);
to
asciiCode = Integer.parseInt(codeArray[indexC], 16);
The reason why you get the same numbers out is because if you don't provide the radix then it defaults to 10.