hexlifyByte function

String hexlifyByte(
  1. int value
)

@param {int} value

This function takes an integer value, converts it to a hexadecimal string, and ensures that the string is at least two characters long by padding with zeros if necessary.

@returns {String} The result is prefixed with "0x"

Implementation

String hexlifyByte(int value) {
  String result = value.toRadixString(16);
  while (result.length < 2) {
    result = "0" + result;
  }

  return "0x" + result;
}