You can actually represent 2 * Short.MAX_VALUE by subtracting Short.MAX_VALUE for each offset and then adding it back when reading.