import struct


def get_int(encoded: bytearray, idx: int) -> tuple:
    """
    Returns an integer and next to be read index
    :param encoded: bytearray
    :param idx: index to start read from
    :return: tuple of int and next index
    """
    return struct.unpack(">i", encoded[idx:idx + 4])[0], idx + 4