Skip to content

Instantly share code, notes, and snippets.

@nuryslyrt
Created July 19, 2017 14:25
Show Gist options
  • Save nuryslyrt/303cdd776fb2e4fd87129063ab7cf25f to your computer and use it in GitHub Desktop.
Save nuryslyrt/303cdd776fb2e4fd87129063ab7cf25f to your computer and use it in GitHub Desktop.
Hex Encoding for String in \x format
public static String hexEncode(String input) {
String out = "";
for (char c : input.toCharArray()) {
out += "\\x" + String.format("%x", new BigInteger(1, input.getBytes(/YOUR_CHARSET?/)));
}
return out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment