void formatDayOfYear ( StringBuilder b , ZonedDateTime d , int width ) { int day = d . getDayOfYear ( ) ; int digits = day < 10 ? 1 : day < 100 ? 2 : 3 ; switch ( digits ) { case 1 : if ( width > 1 ) { b . append ( ' ' ) ; } // fall through case 2 : if ( width > 2 ) { b . append ( ' ' ) ; } // fall through case 3 : b . append ( day ) ; break ; } }
Format the 3 - digit day of the year zero padded .