Skip to content

Instantly share code, notes, and snippets.

@ammachado
Created April 23, 2014 21:16
Show Gist options
  • Save ammachado/11232738 to your computer and use it in GitHub Desktop.
Save ammachado/11232738 to your computer and use it in GitHub Desktop.
import java.util.Formatter;
public class Bytes2Hex {
public static String byteToHex(final byte[] hash) {
try (final Formatter formatter = new Formatter()) {
for (byte b : hash)
formatter.format("%02x", b);
return formatter.toString();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment