You can use the sprintf() function to format values into a string, instead of using Serial.printf to format them as it sends them over the serial port.
Sprintf supports a wide range for formatting operations including decimal and hex display of integers.