Here you can find the source of byteToChar(byte aByte)
public static char byteToChar(byte aByte)
//package com.java2s; //License from project: Open Source License public class Main { public static char byteToChar(byte aByte) { byte ref; if (aByte >= 0 && aByte <= 9) { ref = (byte) '0'; } else if (aByte > 9 && aByte < 16) { ref = (byte) 'a' - 10; } else {/* w ww. j a va 2 s.c o m*/ throw new IllegalArgumentException("The byte '" + aByte + "' cannot be converted to a char"); } return (char) (aByte + ref); } }