@Override
  public ZoneOffset getOffset(Instant instant) {

    long epochSec = instant.getEpochSecond();

    // check if using last rules
    if (this.lastRules.length > 0
        && epochSec > this.savingsInstantTransitions[this.savingsInstantTransitions.length - 1]) {
      int year = findYear(epochSec, this.wallOffsets[this.wallOffsets.length - 1]);
      ZoneOffsetTransition[] transArray = findTransitionArray(year);
      ZoneOffsetTransition trans = null;
      for (int i = 0; i < transArray.length; i++) {
        trans = transArray[i];
        if (epochSec < trans.toEpochSecond()) {
          return trans.getOffsetBefore();
        }
      }
      return trans.getOffsetAfter();
    }

    // using historic rules
    int index = Arrays.binarySearch(this.savingsInstantTransitions, epochSec);
    if (index < 0) {
      // switch negative insert position to start of matched range
      index = -index - 2;
    }
    return this.wallOffsets[index + 1];
  }