package com.ttstd.elderlyassistant.utils; public class HexUtils { // 字节数组转16进制字符串(优化版) public static String bytesToHexString(byte[] bytes) { if (bytes == null) return ""; StringBuilder sb = new StringBuilder(); for (byte b : bytes) { sb.append(String.format("%02X", b)); // 直接格式化为大写16进制 } return sb.toString(); } }