Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void hexdump (String s) {
- byte[] data = null;
- try { data = s.getBytes("us-ascii"); } catch (Exception x) { }
- String h = "", t = "";
- int c = 16;
- for (byte b : data) {
- h += String.format("%02x ", b);
- t += (b < 32 ? "." : String.format("%c", b));
- if (-- c == 0) {
- System.out.printf(": %-48s %-16s\n", h, t);
- c = 16;
- h = t = "";
- }
- }
- if (c < 16)
- System.out.printf(": %-48s %-16s\n", h, t);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement