private List<String> captureSelectedBlock() {
    int startIndex = FileUtils.findIndexBySingleValue(lines, "^\\s*TRANSACTION\\s+DETAIL");
    int endIndex = FileUtils.findIndexBySingleValue(lines, "^\\s*DAILY\\s+BALANCE\\s+INFORMATION");
    List<String> list = FileUtils.getSelectedBlockByIndex(lines, startIndex, endIndex);

    return list;
  }
  private double extractAmountFromKeywordListAndReturnSum() {
    List<Double> list = new ArrayList<>();
    List<String> datelist = new ArrayList<>();
    int count = 0;
    double sum = 0;
    for (int a = 0; a < this.selectedBlock.size(); a++) {

      String value = FileUtils.getLastElementFromArray(this.selectedBlock.get(a));
      value = FileUtils.getDollarSignRemovedValue(value);
      double d = FileUtils.convertStringToDouble(value);
      String[] temp = this.selectedBlock.get(a).trim().split(" ");
      datelist.add(temp[0]);
      list.add(d);
    }
    for (int a = 0; a < list.size(); a++) {
      double d = list.get(a);
      if (d < 3000) {

        ++count;
      } else {
        keywordAmount.add(d);
        keywordDate.add(datelist.get(a));
        keywordDescription.add(keyDescription.get(a));
        sum += d;
      }
    }
    setNoOfValuesLessThan3000(count);
    return sum;
  }
 private List<String> captureDebitBlock() {
   int StartIndex =
       FileUtils.findIndexBySingleValue(lines, "Withdrawals\\s+and\\s+Other\\s+Debits");
   int EndIndex = FileUtils.findIndexBySingleValue(lines, "Daily\\s+Balance\\s+Summary");
   List<String> list = FileUtils.getSelectedBlockByIndex(lines, StartIndex, EndIndex);
   return list;
 }
  private List<String> captureInitialBlock() {
    int startIndex = FileUtils.findIndexBySingleValue(lines, "^\\s*WITHDRAWALS");
    int endIndex =
        FileUtils.findIndexBySingleValue(
            lines, startIndex, "^\\s*CHECKS|^\\s*DAILY\\s+ACCOUNT\\s+BALANCE");

    return FileUtils.getSelectedBlockByIndex(lines, startIndex, endIndex);
  }
  private List<String> captureDepositBlock() {
    int StartIndex = FileUtils.findIndexBySingleValue(lines, "Deposits\\s+and\\s+Other\\s+Credits");
    int EndIndex =
        FileUtils.findIndexBySingleValue(
            lines, "checks\\s+checks|Withdrawals\\s+and\\s+Other\\s+Debits");
    List<String> list = FileUtils.getSelectedBlockByIndex(lines, StartIndex, EndIndex);

    return list;
  }
 private double findOnlineTransferFromSum() {
   List<String> list = captureOnlineTransferFromRecords();
   double sum = 0;
   for (String s : list) {
     String value = FileUtils.getSecondLastElementFromArray(s);
     value = FileUtils.getDollarSignRemovedValue(value);
     double d = FileUtils.convertStringToDouble(value);
     sum += d;
   }
   return sum;
 }
 private List<Double> captureAmountFromSelectedRecords() {
   List<Double> main = new ArrayList<>();
   for (String s : this.filteredBlock) {
     String result = FileUtils.getResultFromPattern("Refund|REFUND|Return", s);
     if (!result.startsWith("NoMatch")) {
       String[] temp = s.split("\\s+");
       main.add(
           FileUtils.convertStringToDouble(
               FileUtils.getDollarSignRemovedValue(temp[temp.length - 1])));
     }
   }
   return main;
 }
 private List<String> captureSelectedBlock() {
   String start = "Transaction\\s+history";
   String end = "Ending\\s+balance\\s+on\\s+\\d{1,2}/";
   List<String> mainList = new ArrayList<>();
   List<String> list = FileUtils.getSelectedBlock(lines, start, end);
   for (String s : list) {
     String result = FileUtils.getResultFromPattern("^\\d{1,2}/\\d{1,2}", s);
     if (!result.startsWith("NoMatch")) {
       //  System.out.println(s);
       mainList.add(s);
     }
   }
   return mainList;
 }
 private double captureAverageLedgerBalance() {
   double d = 0;
   for (String s : lines) {
     String result = FileUtils.getResultFromPattern("Average\\s+Ledger\\s+Balance*", s);
     if (!result.startsWith("NoMatch")) {
       String[] temp = s.split("\\s+");
       d =
           FileUtils.convertStringToDouble(
               FileUtils.getDollarSignRemovedValue(
                   FileUtils.getNegativeSignDetectedValue(temp[3])));
       break;
     }
   }
   return d;
 }
  private double captureTotalDeposits() {
    String result = "";
    double d = 0;
    for (String s : lines) {
      if (s.contains("Credits (+)")) {
        result = s;
        break;
      }
    }
    if (result.length() > 1) {
      String[] temp = result.split("\\s+");
      String dd = FileUtils.getDollarSignRemovedValue(temp[temp.length - 1]);
      d = FileUtils.convertStringToDouble(dd);
    }

    return d;
  }
  private List<Double> captureSelectedBlock() {
    int startIndex = FileUtils.findIndexBySingleValue(lines, "Transaction\\s+History");
    int endIndex = FileUtils.findIndexBySingleValue(lines, "^\\s*Totals");

    List<Double> mainList = new ArrayList<>();
    List<String> selected = new ArrayList<>();

    List<String> list = FileUtils.getSelectedBlockByIndex(lines, startIndex, endIndex);
    for (String s : list) {
      String result = FileUtils.getResultFromPattern("^\\s*\\d{1,2}/\\d{1,2}\\s+", s);
      if (!result.startsWith("NoMatch")) {
        if (selected.size() > 0) {
          if (selected.get(selected.size() - 1).startsWith(result)) {
            selected.set(selected.size() - 1, s);
          } else {
            selected.add(s);
          }
        } else {
          selected.add(s);
        }
      }
    }
    for (int a = 0; a < selected.size(); a++) {
      String[] line = selected.get(a).split(" ");
      if (line.length > 1) {
        mainList.add(
            FileUtils.convertStringToDouble(
                FileUtils.getDollarSignRemovedValue(
                    FileUtils.getBracketRemovedValue(line[line.length - 1]))));
      }
    }

    return mainList;
  }
  private List<String> captureOnlineTransferFromRecords() {

    List<String> list =
        FileUtils.getSelectedRecord(
            this.selectedBlock,
            "Online\\s+Transfer\\s+From|Online\\s+Transfer\\s+from|Online\\s+transfer\\s+from|Account\\s+Transfer\\s+From|Account\\s+transfer\\s+from|Recurring\\s+Transfer\\s+From");

    return list;
  }
  private List<String> captureOnlineReversalFromRecords() {

    List<String> list =
        FileUtils.getSelectedRecord(
            this.selectedBlock,
            "Reversal|Refund|Bounce|Return|Rtrn|REVERSAL|REFUND|BOUNCE|RETURN|RTRN");

    return list;
  }
  private void captureSelectedBlockForDebit() {
    List<String> List = new ArrayList<>();
    List<Double> list = new ArrayList<>();
    List<String> datelist = new ArrayList<>();
    List<Double> CheckDailyPaymentAmount = new ArrayList<>();

    for (int x = 0; x < debitBlock.size(); x++) {
      for (int a = 0; a < words.size(); a++) {
        String wordLine = words.get(a).toLowerCase();
        String result = FileUtils.getResultFromPattern(wordLine, debitBlock.get(x).toLowerCase());
        if (!result.startsWith("NoMatch")) {
          for (int R = x; R > 0; R--) {
            if (debitBlock.get(R).matches("^\\s*\\d{1,2}/\\d{1,2}/\\d{1,2}.+")) {
              List.add(debitBlock.get(R));
              dailykeyDescription.add(words.get(a).toLowerCase());
              break;
            }
          }
          break;
        }
      }
    }
    for (int a = 0; a < List.size(); a++) {
      String value = FileUtils.getLastElementFromArray(List.get(a));
      value = FileUtils.getDollarSignRemovedValue(value);
      double d = FileUtils.convertStringToDouble(value);
      String[] temp = List.get(a).trim().split("\\s+");
      datelist.add(temp[0]);
      list.add(d);
    }
    for (int a = 0; a < list.size(); a++) {
      double d = list.get(a);
      if (CheckDailyPaymentAmount.contains(d)) {
        //  if (!DailypaymentkeywordDescription.contains(dailykeyDescription.get(a)))
        //  {
        DailypaymentkeywordAmount.add(d);
        DailypaymentkeywordDate.add(datelist.get(a));
        DailypaymentkeywordDescription.add(dailykeyDescription.get(a));
        //  }
      } else {
        CheckDailyPaymentAmount.add(d);
      }
    }
  }
 private List<String> captureSelectedRecordsBlock() {
   List<String> list = initialBlock;
   List<String> main = new ArrayList<String>();
   for (String s : list) {
     String result = FileUtils.getResultFromPattern("ONL\\s+TFR\\s+TO|INTERNET\\s+TFR\\s+TO", s);
     if (!result.startsWith("NoMatch") && s.matches("^\\s*\\d{1,2}/\\d{1,2}.+")) {
       main.add(s);
     }
   }
   return main;
 }
 private List<String> captureFilteredBlock() {
   List<String> list = lines;
   List<String> main = new ArrayList<>();
   for (String s : list) {
     String result = FileUtils.getResultFromPattern("^\\D{3}\\s+\\d{1,2}", s);
     if (!result.startsWith("NoMatch")) {
       main.add(s);
     }
   }
   return main;
 }
 private void captureDateDescriptionAmount() {
   List<String> list = this.selectedBlock;
   for (String s : list) {
     String[] temp = s.split("\\s+");
     date.add(temp[0]);
     amount.add(FileUtils.convertStringToDouble(FileUtils.getDollarSignRemovedValue(temp[1])));
     String desc = "";
     for (int a = 2; a < temp.length; a++) {
       desc += temp[a] + " ";
     }
     description.add(desc);
     String res = FileUtils.getResultFromPattern("\\d{7,}", desc);
     if (!res.startsWith("NoMatch")) {
       checkNo.add(FileUtils.getFourDigitAccountNumber(res));
     } else {
       checkNo.add("N/A");
     }
   }
   this.checkNoDuplicateRemoved = FileUtils.removeDuplicateValues(checkNo);
 }
 private String captureDate() {
   String dd = "";
   for (int a = 0; a < lines.size(); a++) {
     String d =
         FileUtils.getResultFromPattern(
             "through\\s+\\D+\\s+\\d{1,2},\\s+\\d{4}", this.lines.get(a));
     if (!d.startsWith("NoMatch")) {
       String[] tmp = d.split("\\s+");
       dd = tmp[tmp.length - 3];
     }
   }
   return dd;
 }
 private List<String> captureSelectedBlockForDeposit() {
   List<String> list = new ArrayList<>();
   for (int x = 0; x < depositBlock.size(); x++) {
     for (int a = 0; a < words.size(); a++) {
       String wordLine = words.get(a).toLowerCase();
       String result = FileUtils.getResultFromPattern(wordLine, depositBlock.get(x).toLowerCase());
       if (!result.startsWith("NoMatch")) {
         for (int R = x; R > 0; R--) {
           if (depositBlock.get(R).matches("^\\s*\\d{1,2}/\\d{1,2}/\\d{1,2}.+")) {
             list.add(depositBlock.get(R));
             keyDescription.add(words.get(a).toLowerCase());
             break;
           }
         }
         break;
       }
     }
   }
   return list;
 }
  private void captureOnlineTransferToRecords() {
    List<String> firstLine = new ArrayList<>();
    List<String> secondLine = new ArrayList<>();
    List<Integer> indexFinder = new ArrayList<>();
    List<String> mergedLine = new ArrayList<>();

    for (int a = 0; a < this.selectedBlock.size(); a++) {
      String result =
          FileUtils.getResultFromPattern(
              "ONLINE\\s+BANKING\\s+TRANSFER\\s+TO", this.selectedBlock.get(a));

      if (!result.startsWith("NoMatch")) {
        indexFinder.add(a + 1);
        firstLine.add(this.selectedBlock.get(a));
        String[] temp = this.selectedBlock.get(a).split("\\s+");
        date.add(temp[0]);
        String value =
            FileUtils.getDollarSignRemovedValue(
                FileUtils.getLastElementFromArray(this.selectedBlock.get(a)));
        double d = FileUtils.convertStringToDouble(value);
        amount.add(d);
        String desc = "";
        for (int x = 1; x < temp.length - 1; x++) {
          desc += temp[x] + " ";
        }
        description.add(desc);
      }
    }
    for (int a = 0; a < indexFinder.size(); a++) {
      String val = selectedBlock.get(indexFinder.get(a));

      String result = this.description.get(a) + " " + val;
      String ch = FileUtils.getResultFromPattern("TO\\s+XX+\\d+", result);
      if (!ch.startsWith("NoMatch")) {
        ch = FileUtils.getFourDigitAccountNumber(ch);
        checkNo.add(ch);
      } else {
        checkNo.add("N/A");
      }
    }
  }
 public CredentialsForHuntington(String[] pages) {
   this.pages = pages;
   this.lines = FileUtils.fillLines(pages);
   startExecution();
 }
 private String captureDate() {
   String result = FileUtils.getResultFromPattern("to\\s+\\d{2}/\\d{2}/\\d{2}", pages[0]);
   return FileUtils.getLastElementFromArray(result);
 }
 private String captureAccountNumber() {
   String result = FileUtils.getResultFromPattern("Account:\\s+\\d+", pages[0]);
   return FileUtils.getFourDigitAccountNumber(result);
 }
 private List<String> removeDuplicateRecords() {
   return FileUtils.removeDuplicateValues(this.checkNo);
 }
 private String captureAccountNumber() {
   String result = FileUtils.getTargetByMatch(pages[0], "Number\\s+\\d+");
   return FileUtils.getFourDigitAccountNumber(result);
 }