Here you can find the source of toBytesShortBE(short w)
public static byte[] toBytesShortBE(short w)
//package com.java2s; public class Main { public static byte[] toBytesShortBE(short w) { byte[] ret = new byte[2]; writeShortBE(ret, 0, w);/*w w w .ja v a 2s . co m*/ return ret; } public static void writeShortBE(byte[] target, int offset, short w) { target[offset] = (byte) ((w >> 8) & 0xFF); // most significant byte first target[offset + 1] = (byte) (w & 0xFF); // least significant byte next } }