class BsDiff {

  static Match searchForMatchBaseCase(
      final RandomAccessObject groupArray,
      final RandomAccessObject oldData,
      final RandomAccessObject newData,
      final int newStart,
      final int oldDataRangeStartA,
      final int oldDataRangeStartB)
      throws IOException {
    // Located the start of a matching range (no further search required) or the size of the range
    // has shrunk to one byte (no further search possible).
    groupArray.seekToIntAligned(oldDataRangeStartA);
    final int groupArrayOldDataRangeStartA = groupArray.readInt();
    final int lengthOfMatchA =
        lengthOfMatch(oldData, groupArrayOldDataRangeStartA, newData, newStart);
    groupArray.seekToIntAligned(oldDataRangeStartB);
    final int groupArrayOldDataRangeStartB = groupArray.readInt();
    final int lengthOfMatchB =
        lengthOfMatch(oldData, groupArrayOldDataRangeStartB, newData, newStart);

    if (lengthOfMatchA > lengthOfMatchB) {
      return Match.of(groupArrayOldDataRangeStartA, lengthOfMatchA);
    }

    return Match.of(groupArrayOldDataRangeStartB, lengthOfMatchB);
  }

}