Here you can find the source of int2ubyte(int in)
public static final byte int2ubyte(int in)
//package com.java2s; //License from project: Apache License public class Main { public static final byte int2ubyte(int in) { in = ((in < 0) ? 0 - in : in) % 256; return (in > 127) ? (byte) (in - 256) : (byte) in; }// w ww. j a v a 2s .c om }