Here you can find the source of toBytes(short value)
public static byte[] toBytes(short value)
//package com.java2s; public class Main { public static byte[] toBytes(short value) { byte[] integer = new byte[4]; integer[0] = (byte) (value & 0x000F); integer[1] = (byte) ((value >> 8) & 0x000F); return integer; }/*from ww w. jav a 2 s .c o m*/ }