private static int getAVTEndOffset(String value, int i) {
    while (true) {
      i = value.indexOf('}', i + 1);
      if (i != -1 && i == value.indexOf("}}", i)) {
        i += 2;
      }
      else {
        break;
      }
    }
    return i;
  }
private static int getAVTEndOffset(String value, int i)