private static void chooseBudget(File[] foundBudgets) {
   Printer.printFoundBudgets(foundBudgets);
   Printer.print("openBudget");
   int index = getChoiceNumber(foundBudgets);
   if (!(index == -5)) {
     System.out.println("Opening " + foundBudgets[index].getName() + "...\n");
     BudgetBoss.setCurrentBudget(loadBudget(index, foundBudgets));
     BudgetBoss.endNeedNewBudget();
   }
 }
 public static void getLoadDirectory() {
   AnsiConsole.out.println(ansi().eraseScreen());
   Printer.print("savedInDefault");
   System.out.println(BudgetBoss.getDefaultDirectory());
   Printer.print("whereSaved");
   String toCheck = Listener.getInput();
   while (InputValidator.pathIsInvalid(toCheck)) toCheck = Listener.getInput();
   if (!(toCheck.equals("exit"))) {
     if (toCheck.equalsIgnoreCase("y")) {
       searchDirectory(BudgetBoss.getDefaultDirectory());
     } else searchDirectory(toCheck);
   }
 }
 private static Budget loadBudget(int index, File[] foundBudgets) {
   FileInputStream newBudget = null;
   ObjectInputStream toLoad = null;
   Object loadedBudget = null;
   try {
     newBudget = new FileInputStream(foundBudgets[index].toString());
   } catch (FileNotFoundException e) {
     Printer.print("wTF");
     System.out.println("Error making the FileInputStream");
   }
   try {
     toLoad = new ObjectInputStream(newBudget);
   } catch (IOException e) {
     Printer.print("wTF");
     System.out.println("Error making the ObjectInputStream");
   }
   try {
     loadedBudget = toLoad.readObject();
   } catch (ClassNotFoundException | IOException e) {
     Printer.print("wTF");
     System.out.println("IO exception, maybe the file is bad?");
   }
   try {
     toLoad.close();
   } catch (IOException e) {
     Printer.print("wTF");
     System.out.println("Couldn't close the Object/File input streams.");
   }
   BudgetBoss.endLoadSavedBudget();
   return (Budget) loadedBudget;
 }
 private static void searchDirectory(String directoryToSearch) {
   AnsiConsole.out.println(ansi().eraseScreen());
   Printer.print("searchingDirectory");
   File[] foundBudgets = Finder.findBudgets(directoryToSearch);
   if (foundBudgets.length > 0) {
     chooseBudget(foundBudgets);
     BudgetBoss.setDefaultDirectory(directoryToSearch);
   } else Printer.print("noBudgetFound");
 }
 private void exitProgram() {
   BudgetBoss.doneUsingBudgetBoss();
   BudgetBoss.endLoadSavedBudget();
   BudgetBoss.endNeedNewBudget();
 }
 private void createBudget() {
   BudgetBoss.endLoadSavedBudget();
   BudgetBoss.needNewBudget();
 }
 private void openBudget() {
   BudgetBoss.loadSavedBudget();
   BudgetBoss.endNeedNewBudget();
 }