Here you can find the source of byteToChar(byte chr)
public static final char byteToChar(byte chr)
//package com.java2s; //License from project: Apache License public class Main { private static final char[] BYTE2CHAR = new char[256]; public static final char byteToChar(byte chr) { // return (chr > 0x20 && chr < 0x7F) ? (char) chr : '.'; return BYTE2CHAR[getUnsignedByte(chr)]; }//from w ww .j a v a2s . co m public static short getUnsignedByte(int value) { return (short) (value & 0xFF); } }