Here you can find the source of intToUByte(int i)
public static byte intToUByte(int i)
//package com.java2s; public class Main { public static byte intToUByte(int i) { if ((i > 255) || (i < 0)) throw new RuntimeException("can't convert " + i + " to an unsigned byte"); return (byte) i; }// w ww . ja v a 2 s. c o m }