title: How to generate N number of weeks from the date given - java
body: <p>I am trying to create <code>N</code> of weeks from the date given and the week list should exclude the week which belongs to the week.</p>
  
  <p>for example if i give todays date then i would like to generate the week excluding this week to <code>N</code> number of weeks.</p>
  
  <p>below is the sample which serves my purpose but i am not able to create the <code>N</code> number of weeks also this piece of code prints the current week.</p>
  
  <pre><code>Calendar currentDate = Calendar.getInstance(Locale.US);
  int firstDayOfWeek = currentDate.getFirstDayOfWeek();
  
  Calendar startDate = Calendar.getInstance(Locale.US);
  startDate.setTime(currentDate.getTime());
  
  int days = (startDate.get(Calendar.DAY_OF_WEEK) + 7 - firstDayOfWeek) % 7;
  startDate.add(Calendar.DATE, -days);
  
  Calendar endDate = Calendar.getInstance(Locale.US);
  endDate.setTime(startDate.getTime());
  endDate.add(Calendar.DATE, 6);
  
  SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
  System.out.println(df.format(startDate.getTime()) + " - " + df.format(endDate.getTime())); 
  </code></pre>
  
  <p>could some one help me on this?</p>