Java Short Number Create toShort(byte[] bytes, int from)

Here you can find the source of toShort(byte[] bytes, int from)

Description

to Short

License

Open Source License

Declaration

public static short toShort(byte[] bytes, int from) 

Method Source Code

//package com.java2s;

public class Main {

    public static short toShort(byte[] bytes, int from) {
        short result = 0;
        for (int i = 0; i < 2; i++) {
            short b = (short) (((int) bytes[from + i]) & 0xFF);
            result = (short) ((result << 8) | b);
        }/* w ww .  jav  a  2  s .  c o m*/
        return result;

    }
}

Related

  1. toShort(byte[] bytes)
  2. toShort(byte[] bytes)
  3. toShort(byte[] bytes)
  4. toShort(byte[] bytes)
  5. toShort(byte[] bytes, boolean bigEndian)
  6. toShort(byte[] bytes, int offset)
  7. toShort(byte[] bytes, int offset)
  8. toShort(byte[] data)
  9. toShort(byte[] input)