/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.time.* ;
import java.time.temporal.* ;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
DayOfWeek firstDayOfWeek = DayOfWeek.MONDAY ;
ZoneId z = ZoneId.of( "America/Montreal" ) ;
YearMonth ym = YearMonth.now( z ) ;
LocalDate monthStart = ym.atDay( 1 ) ;
LocalDate monthStop = ym.atEndOfMonth() ;
LocalDate calendarStart = monthStart.with( TemporalAdjusters.previousOrSame( firstDayOfWeek ) ) ;
LocalDate calendarStop = monthStop.with( TemporalAdjusters.next( firstDayOfWeek ) ) ;
long weeks = ChronoUnit.WEEKS.between( calendarStart , calendarStop ) ;
System.
out.
println( "firstDayOfWeek: " + firstDayOfWeek
) ; System.
out.
println( "ym: " + ym
); System.
out.
println( "month: " + monthStart
+ "/" + monthStop
); System.
out.
println( "calendar: " + calendarStart
+ "/" + calendarStop
); System.
out.
println( "weeks: " + weeks
) ;
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgppbXBvcnQgamF2YS50aW1lLiogOwppbXBvcnQgamF2YS50aW1lLnRlbXBvcmFsLiogOwoKCi8qIE5hbWUgb2YgdGhlIGNsYXNzIGhhcyB0byBiZSAiTWFpbiIgb25seSBpZiB0aGUgY2xhc3MgaXMgcHVibGljLiAqLwpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uCgl7CgpEYXlPZldlZWsgZmlyc3REYXlPZldlZWsgPSBEYXlPZldlZWsuTU9OREFZIDsKClpvbmVJZCB6ID0gWm9uZUlkLm9mKCAiQW1lcmljYS9Nb250cmVhbCIgKSA7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