static String hex(int n) { String hex = (n & 0xFF).toRadixString(16); if (hex.length < 2) { hex = '0' + hex; } return hex.toUpperCase(); }