Here you can find the source of fromShort(short input)
Parameter | Description |
---|---|
input | An short to convert to a byte array. |
public static byte[] fromShort(short input)
//package com.java2s; //License from project: BSD License public class Main { /**// w w w. java 2 s . c om * Returns a byte array containing 2 network byte ordered bytes representing * the given {@code short}. * * @param input An {@code short} to convert to a byte array. * @return A byte array representation of an {@code short} in network byte * order (i.e., big-endian order). */ public static byte[] fromShort(short input) { byte[] output = new byte[2]; output[0] = (byte) (input >> 8); output[1] = (byte) input; return output; } }