code: private int addIndexedSplits(
  			List<InputSplit> splits, int i, List<InputSplit> newSplits,
  			Configuration cfg)
  		throws IOException
  	{
  		final Path file = ((FileSplit)splits.get(i)).getPath();
  
  		final BGZFBlockIndex idx = new BGZFBlockIndex(
  			file.getFileSystem(cfg).open(getIdxPath(file)));
  
  		int splitsEnd = splits.size();
  		for (int j = i; j < splitsEnd; ++j)
  			if (!file.equals(((FileSplit)splits.get(j)).getPath()))
  				splitsEnd = j;
  
  		for (int j = i; j < splitsEnd; ++j) {
  			final FileSplit fileSplit = (FileSplit)splits.get(j);
  
  			final long start =         fileSplit.getStart();
  			final long end   = start + fileSplit.getLength();
  
  			final Long blockStart = idx.prevBlock(start);
  			final Long blockEnd   = j == splitsEnd-1 ? idx.prevBlock(end)
  			                                         : idx.nextBlock(end);
  
  			if (blockStart == null)
  				throw new RuntimeException(
  					"Internal error or invalid index: no block start for " +start);
  
  			if (blockEnd == null)
  				throw new RuntimeException(
  					"Internal error or invalid index: no block end for " +end);
  
  			newSplits.add(new FileSplit(
  				file, blockStart, blockEnd - blockStart,
  				fileSplit.getLocations()));
  		}
  		return splitsEnd;
  	}
docs: returning the next index to be used.