Replaced Unneeded ToUpper call and concats.

The ToUpper() function call can be removed by changing the "x" to "X".
Additionally, the PadLeft() call performs the same function as the while
loop, and does it faster.

The execution time with the changed code is half of what it was before.
Moved Calls Within Loops to Outside.

The changes made - combined with the changes to GetHexString - reduced
execution time per call from 12ms to 7ms.