public class ConvToByte { /** * short 类型转换成byte 数组 * * @param param * 待转的short * @return * * @author li * @date 2014-1-16 上午 10:03:47 */ public static byte[] shortToByteArr(short param) { byte[] arr = new byte[2]; arr[0] = (byte) ((param >> 8) & 0xff); arr[1] = (byte) (param & 0xff); return arr; } /** * int 类型转换成byte 数组 * * @param param * 待转的int * @return * * @author li * @date 2014-1-16 上午 10:03:47 */ public static byte[] intToByteArr(int param) { byte[] arr = new byte[4]; arr[0] = (byte) ((param >> 24) & 0xff); arr[1] = (byte) ((param >> 16) & 0xff); arr[2] = (byte) ((param >> 8) & 0xff); arr[3] = (byte) (param & 0xff); return arr; } /** * long 类型转换成byte 数组 * * @param param * 待转的long * @return * * @author li * @date 2014-1-16 上午 10:03:47 */ public static byte[] longToByteArr(long param) { byte[] arr = new byte[8]; arr[0] = (byte) ((param >> 56) & 0xff); arr[1] = (byte) ((param >> 48) & 0xff); arr[2] = (byte) ((param >> 40) & 0xff); arr[3] = (byte) ((param >> 32) & 0xff); arr[4] = (byte) ((param >> 24) & 0xff); arr[5] = (byte) ((param >> 16) & 0xff); arr[6] = (byte) ((param >> 8) & 0xff); arr[7] = (byte) (param & 0xff); return arr; } /** * 字符到字节转换 * * @param ch * 字符 * @return * * @author li * @date 2014-1-16 下午 4:10:07 */ public static byte[] charToByteArr(char ch) { byte[] b = new byte[2]; int temp = (int) ch; b[0] = (byte) (temp >> 8 & 0xff); b[1] = (byte) (temp & 0xff); return b; } /** * double 转换 byte 数组 * * @param param * double * @return byte 数组 * * @author li * @date 2014-1-16 下午 4:45:57 */ public static byte[] doubleToByteArr(double param) { byte[] b = new byte[8]; long l = Double.doubleToLo...