Here you can find the source of shortToByte(short number)
public static byte[] shortToByte(short number)
//package com.java2s; public class Main { public static byte[] shortToByte(short number) { int temp = number; byte[] b = new byte[2]; for (int i = (b.length - 1); i >= 0; i--) { b[i] = new Integer(temp & 0xff).byteValue(); temp = temp >> 8;/*w ww. j a v a 2 s. co m*/ } return b; } }