Here you can find the source of toShort(byte mostSignificant, byte leastSignificant)
Parameter | Description |
---|---|
mostSignificant | The most significant number part |
leastSignificant | The least significant number part |
public static short toShort(byte mostSignificant, byte leastSignificant)
//package com.java2s; //License from project: Open Source License public class Main { /**/*w ww. j a v a 2 s. c o m*/ * Converts a pair of bytes to a {@code short} * @param mostSignificant The most significant number part * @param leastSignificant The least significant number part * @return A {@code short} */ public static short toShort(byte mostSignificant, byte leastSignificant) { short n = 0; n ^= mostSignificant & 0xFF; n <<= 8; n ^= leastSignificant & 0xFF; return n; } }