What you need here is to format a byte as two hex digits.
sb.append(String.format("%02x", result[i]));
would do it.
If you need uppercase hex digits, use
sb.append(String.format("%02X", result[i]));
Additionaly if you do not mind spaces between encoded bytes, you can use
new sun.misc.HexDumpEncoder().encode(result).substring(6);
to encode the whole byte[] at once.