I've just written the longest code in my short professional life:) It produces the expected output but I'm wondering if I could make it any simpler. The second issue is that after verification the website says, "Be sure that the toHex(String) method returns an empty string if it receives an empty string as input. Be sure that the toBinary(String) method returns an empty string if it receives an empty string as input", although these methods in my code start with the following lines (correspondingly): (1)
if (binaryNumber.isEmpty())
    return null;
(2)
if (hexNumber.isEmpty())
    return null;