fork download
  1. import java.util.Calendar;
  2. import java.util.GregorianCalendar;
  3.  
  4. public class Main {
  5.  
  6. public static void main(String[] args) {
  7.  
  8. System.out.println("" + cal.getTime());
  9. int i = cal.get(7);
  10. if (i == 1) { // sunday
  11. cal.add(Calendar.DAY_OF_WEEK, 3);
  12. } else if (i == 2) { // monday
  13. cal.add(Calendar.DAY_OF_WEEK, 2);
  14. } else if (i == 3) { // tuesdat
  15. cal.add(Calendar.DAY_OF_WEEK, 1);
  16. } else if (i == 4) { // wednesday
  17. cal.add(Calendar.DAY_OF_WEEK, 7);
  18. } else if (i == 5) { // hursday
  19. cal.add(Calendar.DAY_OF_WEEK, 6);
  20. } else if (i == 6) { // friday
  21. cal.add(Calendar.DAY_OF_WEEK, 5);
  22. } else if (i == 7) { // saturday
  23. cal.add(Calendar.DAY_OF_WEEK, 4);
  24. }
  25.  
  26. System.out.println("" + cal.getTime());
  27. }
  28. }
  29.  
Success #stdin #stdout 0.05s 246080KB
stdin
Standard input is empty
stdout
Wed Jun 27 12:42:32 GMT 2012
Wed Jul 04 12:42:32 GMT 2012