Java Short Number Create toShort(byte[] b)

Here you can find the source of toShort(byte[] b)

Description

to Short

License

Apache License

Declaration

public static short toShort(byte[] b) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static short toShort(byte[] b) {
        short s = 0;
        short s0 = (short) (b[0] & 0xff);
        short s1 = (short) (b[1] & 0xff);
        s1 <<= 8;//from   w  ww .j  a  va2  s  .  com
        s = (short) (s0 | s1);
        return s;
    }
}

Related

  1. toShort(byte msb, byte lsb)
  2. toShort(byte... b)
  3. toShort(byte... b)
  4. toShort(byte[] b)
  5. toShort(byte[] b)
  6. toShort(byte[] b)
  7. toShort(byte[] b)
  8. toShort(byte[] b, int off, boolean bigEndian)
  9. toShort(byte[] b, int offset)