Refactored the formatHex method to enhance efficiency and address potential memory issues. The improvements include the use of a StringBuilder for string construction, masking the value to fit within the specified digits, calculating leading zeros, and optimizing the hex value append operation. These changes result in more memory-efficient handling of large numbers.
Fixes #640
Refactored the formatHex method to enhance efficiency and address potential memory issues. The improvements include the use of a StringBuilder for string construction, masking the value to fit within the specified digits, calculating leading zeros, and optimizing the hex value append operation. These changes result in more memory-efficient handling of large numbers.