Your problem is that it getFirstDayOfWeek()returns the first day of the week; for example, Sunday in the USA, Monday in France. It does not return the day of the month. See javadoc .
The first day of the month that begins at the beginning of the week (in pseudo-code)
((7 + (firstDayOfWeek - dayOfWeek(firstOfMonth))) % 7) + 1
You can translate this into code java.util.Calendarif you want, but I would suggest using Joda's time.
.
, , add
currCalendar.add(Calendar.DAY_OF_MONTH, -7)
, add .
add(f, delta)
delta f. set(f, get(f) + delta) :
1. f f delta, , f. , , , .