class Bytes {

    public static byte[] toByteArray(int... uints) {
        byte[] bytez = new byte[uints.length];
        for (int i = 0; i < uints.length; i++) {
            if (uints[i] > 255 || uints[i] < 0)
                throw new IllegalArgumentException("Cannot convert to byte. Number should be between 0 and (255) 0xff. " +
                        "Number:" + uints[i]);
            bytez[i] = (byte) (uints[i] & 0xff);
        }
        return bytez;
    }

}