Here you can find the source of dumpMessage(byte b[])
public static String dumpMessage(byte b[])
//package com.java2s; //License from project: Open Source License public class Main { public static String dumpMessage(byte b[]) { return dumpMessage(b, 0, b.length); }/*w w w. j av a2 s . c o m*/ public static String dumpMessage(byte b[], int pos, int len) { StringBuilder sb = new StringBuilder(); sb.append('['); for (int i = pos; i < len; i++) switch (b[i]) { case 2: // '\002' sb.append("&STX;"); break; case 3: // '\003' sb.append("&ETX;"); break; case 27: // '\033' sb.append("&ESC;"); break; default: sb.append((char) b[i]); break; } sb.append(']'); return sb.toString(); } }