private void checkAndSetFastPathStatus(){
  boolean fastPathWasOn=isFastPath;
  if ((roundingMode == RoundingMode.HALF_EVEN) && (isGroupingUsed()) && (groupingSize == 3)&& (multiplier == 1)&& (!decimalSeparatorAlwaysShown)&& (!useExponentialNotation)) {
    isFastPath=((minimumIntegerDigits == 1) && (maximumIntegerDigits >= 10));
    if (isFastPath) {
      if (isCurrencyFormat) {
        if ((minimumFractionDigits != 2) || (maximumFractionDigits != 2))         isFastPath=false;
      }
 else       if ((minimumFractionDigits != 0) || (maximumFractionDigits != 3))       isFastPath=false;
    }
  }
 else   isFastPath=false;
  if (isFastPath) {
    if (fastPathData == null)     fastPathData=new FastPathData();
    fastPathData.zeroDelta=symbols.getZeroDigit() - '0';
    fastPathData.groupingChar=symbols.getGroupingSeparator();
    fastPathData.fractionalMaxIntBound=(isCurrencyFormat) ? 99 : 999;
    fastPathData.fractionalScaleFactor=(isCurrencyFormat) ? 100.0d : 1000.0d;
    fastPathData.positiveAffixesRequired=(positivePrefix.length() != 0) || (positiveSuffix.length() != 0);
    fastPathData.negativeAffixesRequired=(negativePrefix.length() != 0) || (negativeSuffix.length() != 0);
    int maxNbIntegralDigits=10;
    int maxNbGroups=3;
    int containerSize=Math.max(positivePrefix.length(),negativePrefix.length()) + maxNbIntegralDigits + maxNbGroups+ 1+ maximumFractionDigits+ Math.max(positiveSuffix.length(),negativeSuffix.length());
    fastPathData.fastPathContainer=new char[containerSize];
    fastPathData.charsPositiveSuffix=positiveSuffix.toCharArray();
    fastPathData.charsNegativeSuffix=negativeSuffix.toCharArray();
    fastPathData.charsPositivePrefix=positivePrefix.toCharArray();
    fastPathData.charsNegativePrefix=negativePrefix.toCharArray();
    int longestPrefixLength=Math.max(positivePrefix.length(),negativePrefix.length());
    int decimalPointIndex=maxNbIntegralDigits + maxNbGroups + longestPrefixLength;
    fastPathData.integralLastIndex=decimalPointIndex - 1;
    fastPathData.fractionalFirstIndex=decimalPointIndex + 1;
    fastPathData.fastPathContainer[decimalPointIndex]=isCurrencyFormat ? symbols.getMonetaryDecimalSeparator() : symbols.getDecimalSeparator();
  }
 else   if (fastPathWasOn) {
    fastPathData.fastPathContainer=null;
    fastPathData.charsPositiveSuffix=null;
    fastPathData.charsNegativeSuffix=null;
    fastPathData.charsPositivePrefix=null;
    fastPathData.charsNegativePrefix=null;
  }
  fastPathCheckNeeded=false;
}

private void checkAndSetFastPathStatus ( ) { boolean fastPathWasOn = isFastPath ; if ( ( roundingMode == RoundingMode . HALF_EVEN ) && ( isGroupingUsed ( ) ) && ( groupingSize == 3 ) && ( multiplier == 1 ) && ( ! decimalSeparatorAlwaysShown ) && ( ! useExponentialNotation ) ) { isFastPath = ( ( minimumIntegerDigits == 1 ) && ( maximumIntegerDigits >= 10 ) ) ; if ( isFastPath ) { if ( isCurrencyFormat ) { if ( ( minimumFractionDigits != 2 ) || ( maximumFractionDigits != 2 ) ) isFastPath = false ; } else if ( ( minimumFractionDigits != 0 ) || ( maximumFractionDigits != 3 ) ) isFastPath = false ; } } else isFastPath = false ; if ( isFastPath ) { if ( fastPathData == null ) fastPathData = new FastPathData ( ) ; fastPathData . zeroDelta = symbols . getZeroDigit ( ) - '0' ; fastPathData . groupingChar = symbols . getGroupingSeparator ( ) ; fastPathData . fractionalMaxIntBound = ( isCurrencyFormat ) ? 99 : 999 ; fastPathData . fractionalScaleFactor = ( isCurrencyFormat ) ? 100.0d : 1000.0d ; fastPathData . positiveAffixesRequired = ( positivePrefix . length ( ) != 0 ) || ( positiveSuffix . length ( ) != 0 ) ; fastPathData . negativeAffixesRequired = ( negativePrefix . length ( ) != 0 ) || ( negativeSuffix . length ( ) != 0 ) ; int maxNbIntegralDigits = 10 ; int maxNbGroups = 3 ; int containerSize = Math . max ( positivePrefix . length ( ) , negativePrefix . length ( ) ) + maxNbIntegralDigits + maxNbGroups + 1 + maximumFractionDigits + Math . max ( positiveSuffix . length ( ) , negativeSuffix . length ( ) ) ; fastPathData . fastPathContainer = new char [ containerSize ] ; fastPathData . charsPositiveSuffix = positiveSuffix . toCharArray ( ) ; fastPathData . charsNegativeSuffix = negativeSuffix . toCharArray ( ) ; fastPathData . charsPositivePrefix = positivePrefix . toCharArray ( ) ; fastPathData . charsNegativePrefix = negativePrefix . toCharArray ( ) ; int longestPrefixLength = Math . max ( positivePrefix . length ( ) , negativePrefix . length ( ) ) ; int decimalPointIndex = maxNbIntegralDigits + maxNbGroups + longestPrefixLength ; fastPathData . integralLastIndex = decimalPointIndex - 1 ; fastPathData . fractionalFirstIndex = decimalPointIndex + 1 ; fastPathData . fastPathContainer [ decimalPointIndex ] = isCurrencyFormat ? symbols . getMonetaryDecimalSeparator ( ) : symbols . getDecimalSeparator ( ) ; } else if ( fastPathWasOn ) { fastPathData . fastPathContainer = null ; fastPathData . charsPositiveSuffix = null ; fastPathData . charsNegativeSuffix = null ; fastPathData . charsPositivePrefix = null ; fastPathData . charsNegativePrefix = null ; } fastPathCheckNeeded = false ; }
check validity of using fast - path for this instance . if fast - path is valid for this instance , sets fast - path state as true and initializes fast - path utility fields as needed . this method is supposed to be called rarely , otherwise that will break the fast - path performance . that means avoiding frequent changes of the properties of the instance , since for most properties , each time a change happens , a call to this method is needed at the next format call . fast - path rules : similar to the default decimalformat instantiation case . more precisely : - half_even rounding mode , - isgroupingused ( ) is true , - groupingsize of 3 , - multiplier is 1 , - decimal separator not mandatory , - no use of exponential notation , - minimumintegerdigits is exactly 1 and maximumintegerdigits at least 10 - for number of fractional digits , the exact values found in the default case : currency : min = max = 2 . decimal : min = 0 . max = 3 .
