Java Byte Array to Short bytesToShort(byte[] bytes, int start)

Here you can find the source of bytesToShort(byte[] bytes, int start)

Description

bytes To Short

License

LGPL

Declaration

public static short bytesToShort(byte[] bytes, int start) 

Method Source Code

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

public class Main {
    public static short bytesToShort(byte[] bytes, int start) {
        short a = (short) (0xff & bytes[start + 0]);
        short b = (short) (0xff00 & (bytes[start + 1] << 8));
        return (short) (a + b);
    }// ww w.j a  va 2 s  .  c  o m
}

Related

  1. bytesToShort(byte[] bytes, boolean netOrder)
  2. bytesToShort(byte[] bytes, int off)
  3. bytesToShort(byte[] bytes, int off, boolean bigEndian)
  4. bytesToShort(byte[] bytes, int off, int len, boolean little)
  5. bytesToShort(byte[] bytes, int offset)
  6. bytesToShort(byte[] bytes, int startIndex)
  7. bytesToShort(byte[] shortBytes)
  8. bytesToShort(final byte byte0, final byte byte1)
  9. bytesToShort(final byte[] aBuffer, final int aPos)