Here you can find the source of fromShort(int shortValue)
Parameter | Description |
---|---|
shortValue | The short to interpret to binary |
public static byte[] fromShort(int shortValue)
//package com.java2s; /*//from w ww .ja va 2s . co m * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ public class Main { /** * Interpret a short as its binary form * * @param shortValue The short to interpret to binary * * @return The binary */ public static byte[] fromShort(int shortValue) { byte[] bytes = new byte[2]; bytes[0] = (byte) (shortValue >> 8); bytes[1] = (byte) ((shortValue << 8) >> 8); return bytes; } }