I don't know if somebody has already answered this question. If it's the case, then, please for the redondancy.
I would like to transform this function into Kotlin function. Thanks for the help.
private final static String HEX = "XXXXXXXXX";
private static void appendHex(StringBuffer sb, byte b) {
sb.append(HEX.charAt((b>>4)&0x0f)).append(HEX.charAt(b&0x0f));
}
HEXactually rather contains something like0123456789ABCDEF? if so... what about:String.format("%02X", b)instead?sb.append(HEX.charAt((b>>4)&0x0f)).append(HEX.charAt(b&0x0f));is what you want to translate to Kotlin right? But if it is already simplifiable tosb.append(String.format("%02X", b)), that's not ok for you?Bytewith>>.