public StringBuilder formatMeasures ( StringBuilder appendTo , FieldPosition fieldPosition , Measure ... measures ) { // fast track for trivial cases if ( measures . length == 0 ) { return appendTo ; } if ( measures . length == 1 ) { return formatMeasure ( measures [ 0 ] , numberFormat , appendTo , fieldPosition ) ; } if ( formatWidth == FormatWidth . NUMERIC ) { // If we have just hour, minute, or second follow the numeric // track. Number [ ] hms = toHMS ( measures ) ; if ( hms != null ) { return formatNumeric ( hms , appendTo ) ; } } ListFormatter listFormatter = ListFormatter . getInstance ( getLocale ( ) , formatWidth . getListFormatterStyle ( ) ) ; if ( fieldPosition != DontCareFieldPosition . INSTANCE ) { return formatMeasuresSlowTrack ( listFormatter , appendTo , fieldPosition , measures ) ; } // Fast track: No field position. String [ ] results = new String [ measures . length ] ; for ( int i = 0 ; i < measures . length ; i ++ ) { results [ i ] = formatMeasure ( measures [ i ] , i == measures . length - 1 ? numberFormat : integerFormat ) ; } return appendTo . append ( listFormatter . format ( ( Object [ ] ) results ) ) ; }
Formats a sequence of measures .