TL; DR
ChronoUnit.WEEKS.between( calendarStart , calendarStop )
Avoid obsolete classes
Avoid the problematic old time classes that are now obsolete are being superseded by modern java.time classes.
java.time
Track the day of the week with DayOfWeek enum.
DayOfWeek firstDayOfWeek = DayOfWeek.MONDAY ;
Get the month of interest presented by YearMonth . Perhaps in the current month. During the current month, you must indicate the desired / expected time zone, since for any given moment, the date can be changed worldwide for the zone.
ZoneId z = ZoneId.of( "America/Montreal" ) ; YearMonth ym = YearMonth.now( z ) ;
Get the first and last day of the month.
LocalDate monthStart = ym.atDay( 1 ) ; LocalDate monthStop = ym.atEndOfMonth() ;
Get the date for the day of the week. To do this, use the TemporalAdjuster , one of which is represented by TemporalAdjusters (note the plural s ).
Time spaces in java.time are reasonably defined using the Half-Open approach, where the beginning is included, while the ending is exclusive. So, pay attention to how we need to get the date of the desired day of the week after the end of the month. If the end of the month in itself has become a desirable day of the week, we need to go past it.
LocalDate calendarStart = monthStart.with( TemporalAdjusters.previousOrSame( firstDayOfWeek ) ) ; LocalDate calendarStop = monthStop.with( TemporalAdjusters.next( firstDayOfWeek ) ) ;
Calculate the number of weeks between.
long weeks = ChronoUnit.WEEKS.between( calendarStart , calendarStop ) ;
See this code running on IdeOne.com .
firstDayOfWeek: MONDAY
ym: 2017-09
month: 2017-09-01 / 2017-09-30
calendar: 2017-08-28 / 2017-10-02
weeks: 5

About java.time
The java.time framework is built into Java 8 and later. These classes supersede the nasty old legacy time classes such as java.util.Date , Calendar and SimpleDateFormat .
The Joda-Time project, now in maintenance mode , we recommend switching to the java.time classes.
To learn more, see the Oracle Tutorial . And search for qaru for many examples and explanations. JSR 310 specification .
Where to get java.time classes?
- Java SE 8 , Java SE 9 , and then
- Built in.
- Part of the standard Java API with integrated implementation.
- Java 9 adds some minor features and fixes.
- Java SE 6 and Java SE 7
- Most of the functionality of java.time has been ported to Java 6 and 7 in ThreeTen-Backport .
- Android
- The ThreeTenABP project adapts ThreeTen-Backport (mentioned above) specifically for Android.
- See How to use ThreeTenABP ....
The ThreeTen-Extra project extends java.time with additional classes. This project is a proof of possible future additions to java.time. Here you can find useful classes such as Interval , YearWeek , YearQuarter and more .