Java tutorial
//package com.java2s; public class Main { /** * Convert uint8 into char( we treat char as uint8) * * @param uint8 * the unit8 to be converted * @return the byte of the unint8 */ public static byte convertUint8toByte(char uint8) { if (uint8 > Byte.MAX_VALUE - Byte.MIN_VALUE) { throw new RuntimeException("Out of Boundary"); } return (byte) uint8; } }