Here you can find the source of toCharString(byte[] bytes)
public static String toCharString(byte[] bytes)
//package com.java2s; public class Main { public static String toCharString(byte[] bytes) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { char c = (char) (bytes[i] & 0xFF); sb.append(c);/* w w w. j a v a 2 s . c o m*/ sb.append(' '); if (i % 8 == 7) { sb.append('\n'); sb.append(' '); sb.append(' '); } } return sb.toString(); } }