Public Static voidMain (string[] args) {List<String> list =NewArraylist<string> ();//List of holidays, from the database in a formal environment based on date criteriaList.add ("2017-06-24")); List.add ("2017-06-25"); List.add ("2017-07-01"); List.add ("2017-07-02"); List.add ("2017-07-08"); List.add ("2017-07-09"); Date curdate= GetDate ("2017-06-23")); intDays = 3; for(inti = 1; I <=Days ;) {Curdate=addDays (curdate); if(!list.contains (NewSimpleDateFormat ("Yyyy-mm-dd"). Format (curdate))) {i++; }} System.out.println (NewSimpleDateFormat ("Yyyy-mm-dd"). Format (curdate)); } Public StaticDate addDays (date date) {Calendar Calendar=NewGregorianCalendar (); Calendar.settime (date); Calendar.add (Calendar.date,1); returnCalendar.gettime (); } Public StaticDate getDate (String str) {Try { return NewSimpleDateFormat ("Yyyy-mm-dd"). Parse (str); } Catch(ParseException ex) {Logger.getlogger (T05.class. GetName ()). log (Level.severe,NULL, ex); } return NULL; }
Java implementation gets the number of days after this date, based on the date entered and the number of days