Here you can find the source of byteToChar(int b, char unprintable)
public static char byteToChar(int b, char unprintable)
//package com.java2s; // Licensed under the Academic Free License version 3.0 public class Main { /**//from w w w . j a v a 2 s . c o m * Translate the byte into an ASCII char if it * is printable. If not return the given * unprintable char. */ public static char byteToChar(int b, char unprintable) { if ((b < 32) || (b > 126)) return unprintable; else return (char) b; } }