Here you can find the source of intToByte(int num)
public static byte intToByte(int num)
//package com.java2s; public class Main { public static byte intToByte(int num) { byte high = (byte) ((num >> 4) & 0x0F); byte low = (byte) (num & 0x0F); byte value = (byte) ((high << 4) + low); return value; }/*from ww w .java 2s . c o m*/ }