code: public String getWeekdayRelativeTo(String date, int weekday, int number, boolean count_itself) {
  		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
  		Calendar c = Calendar.getInstance();
  				
  		int day;
  		int add;
  		
  		if(number == 0) {
  			try{
  				c.setTime(formatter.parse(date));
  				date = formatter.format(c.getTime());
  			} catch (ParseException e) {
  				e.printStackTrace();
  			}
  			return date;			
  		}
  		else{
  			
  			if(number<0) {
  				number+=1;
  			}
  						
  			try{
  				c.setTime(formatter.parse(date));
  				day = c.get(Calendar.DAY_OF_WEEK);
  				if((count_itself && number>0) || (!count_itself && number <= 0)) {
  					if(day<=weekday) {
  						add = weekday - day;
  					}
  					else{
  						add = weekday - day + 7;
  					}	
  				}
  				else{
  					if(day<weekday) {
  						add = weekday - day;
  					}
  					else{
  						add = weekday - day + 7;
  					}	
  				}
  				add += (( number - 1) * 7);
  				c.add(Calendar.DAY_OF_MONTH, add);
  				date = formatter.format(c.getTime());
  			} catch (ParseException e) {
  				e.printStackTrace();
  			}
  			return date;
  		}
  	}
docs: Get the date of a weekday relative to a date, e.g. first Wednesday before 11-23
  
  @author Hans-Peter Pfeiffer
  @param date
  @param weekday
  @param number
  @param count_itself
  @return