def int_from_32bit_array(val):
    """Converts an integer from a 32 bit bytearray

    :param val: the value to convert to an int
    :type val: int

    :rtype: int
    """
    rval = 0
    for fragment in bytearray(val):
        rval <<= 8
        rval |= fragment
    return rval