Android Big Endian to Int Convert bigEndToInt(byte[] array, int start)

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

Description

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

Declaration

public static int bigEndToInt(byte[] array, int start) 

Method Source Code

//package com.java2s;

public class Main {
    /**/* w  w w .  j  a  va 2 s  .c om*/
     * Converts a byte array into int 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 int bigEndToInt(byte[] array, int start) {
        return (((array[start + 0] & 0xFF) << 24)
                | ((array[start + 1] & 0xFF) << 16)
                | ((array[start + 2] & 0xFF) << 8) | (array[start + 3] & 0xFF));
    }
}