Android Big Endian to Short Convert bigEndToShort(byte[] array, int start)

Here you can find the source of bigEndToShort(byte[] array, int start)

Description

Converts a byte array into short from big-endian format.

Declaration

public static short bigEndToShort(byte[] array, int start) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  w ww. j  a v  a 2  s. c om
     * Converts a byte array into short from big-endian format.
     * \param array The byte array to convert from.
     * \param start The starting point, int the array \a a, where the
     * conversion should start.
     * \returns The number after the conversion.
     **/
    public static short bigEndToShort(byte[] array, int start) {
        return (short) ((array[start + 0] << 8) | (array[start + 1] & 0xFF));
    }
}