Java Short Number Create toShort(byte b0, byte b1)

Here you can find the source of toShort(byte b0, byte b1)

Description

Returns a short built from two bytes.

License

Open Source License

Parameter

Parameter Description
b0 the least significant byte
b1 the most significant byte

Declaration

public static short toShort(byte b0, byte b1) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  w  ww  .ja  v  a 2  s. c om
     * Returns a short built from two bytes.
     *
     * @param b0    the least significant byte
     * @param b1    the most significant byte
     */
    public static short toShort(byte b0, byte b1) {
        return (short) (b0 & 0xFF | b1 << 8);
    }
}

Related

  1. toShort(byte a, byte b)
  2. toShort(byte byte0, byte byte1)
  3. toShort(byte mostSignificant, byte leastSignificant)
  4. toShort(byte msb, byte lsb)
  5. toShort(byte... b)