Here you can find the source of intToOneByte(int value)
public static byte intToOneByte(int value)
//package com.java2s; public class Main { private static final String ERR_VALUE_OOB = "Value out of bounds (%s)"; public static final int MAX_8BITS = 255; public static byte intToOneByte(int value) { if ((value < 0) || (value > MAX_8BITS)) throw new IllegalArgumentException(String.format(ERR_VALUE_OOB, value)); return (byte) (value & 0xFF); }//from ww w . j a v a2s. com }