I have tested it with various online calculators, and it seems to output the correct solution. Additionally, I looked through the other questions pertaining to this task, but I must be missing something because I cannot figure out where I am going wrong. Any help, even if it is just an input that does not work correctly with my code, would be greatly appreciated. Edit: I ended up solving this task by going at it differently than my code in this post. To solve it I just created if statements for each hexadecimal number/ symbol. Example:
if(hexNumber.charAt(i) == '0') binary += "0000";
I placed all of these in a for loop that went through each character in the given hexadecimal number. I really do not see how this would work and my previous code would not as this code leaves a redundant 0000 at the beginning of the conversion if the hexadecimal begins with 0. Maybe this is why my previous code failed though. I cannot test it now as verification is complete. If anyone can confirm if this is the case that would be great.