Here you can find the source of hexDump(String prompt, byte[] bs)
public static void hexDump(String prompt, byte[] bs)
//package com.java2s; //License from project: Open Source License import java.io.BufferedOutputStream; import java.io.PrintStream; public class Main { public static void hexDump(String prompt, byte[] bs) { PrintStream ps = new PrintStream(new BufferedOutputStream(System.out, 2048)); ps.printf("%s:", prompt); for (byte b : bs) ps.printf("%02x ", b); ps.printf("["); for (byte b : bs) ps.printf("%c", Character.isLetterOrDigit(b) ? b : '.'); ps.printf("]\n"); ps.flush();/* w w w . j a v a 2 s .co m*/ } }