private void buildNationalNumberForParsing(String numberToParse,StringBuilder nationalNumber){
  int indexOfPhoneContext=numberToParse.indexOf(RFC3966_PHONE_CONTEXT);
  if (indexOfPhoneContext > 0) {
    int phoneContextStart=indexOfPhoneContext + RFC3966_PHONE_CONTEXT.length();
    if (numberToParse.charAt(phoneContextStart) == PLUS_SIGN) {
      int phoneContextEnd=numberToParse.indexOf(';',phoneContextStart);
      if (phoneContextEnd > 0) {
        nationalNumber.append(numberToParse.substring(phoneContextStart,phoneContextEnd));
      }
 else {
        nationalNumber.append(numberToParse.substring(phoneContextStart));
      }
    }
    int indexOfRfc3966Prefix=numberToParse.indexOf(RFC3966_PREFIX);
    int indexOfNationalNumber=(indexOfRfc3966Prefix >= 0) ? indexOfRfc3966Prefix + RFC3966_PREFIX.length() : 0;
    nationalNumber.append(numberToParse.substring(indexOfNationalNumber,indexOfPhoneContext));
  }
 else {
    nationalNumber.append(extractPossibleNumber(numberToParse));
  }
  int indexOfIsdn=nationalNumber.indexOf(RFC3966_ISDN_SUBADDRESS);
  if (indexOfIsdn > 0) {
    nationalNumber.delete(indexOfIsdn,nationalNumber.length());
  }
}

private void buildNationalNumberForParsing ( String numberToParse , StringBuilder nationalNumber ) { int indexOfPhoneContext = numberToParse . indexOf ( RFC3966_PHONE_CONTEXT ) ; if ( indexOfPhoneContext > 0 ) { int phoneContextStart = indexOfPhoneContext + RFC3966_PHONE_CONTEXT . length ( ) ; if ( numberToParse . charAt ( phoneContextStart ) == PLUS_SIGN ) { int phoneContextEnd = numberToParse . indexOf ( ';' , phoneContextStart ) ; if ( phoneContextEnd > 0 ) { nationalNumber . append ( numberToParse . substring ( phoneContextStart , phoneContextEnd ) ) ; } else { nationalNumber . append ( numberToParse . substring ( phoneContextStart ) ) ; } } int indexOfRfc3966Prefix = numberToParse . indexOf ( RFC3966_PREFIX ) ; int indexOfNationalNumber = ( indexOfRfc3966Prefix >= 0 ) ? indexOfRfc3966Prefix + RFC3966_PREFIX . length ( ) : 0 ; nationalNumber . append ( numberToParse . substring ( indexOfNationalNumber , indexOfPhoneContext ) ) ; } else { nationalNumber . append ( extractPossibleNumber ( numberToParse ) ) ; } int indexOfIsdn = nationalNumber . indexOf ( RFC3966_ISDN_SUBADDRESS ) ; if ( indexOfIsdn > 0 ) { nationalNumber . delete ( indexOfIsdn , nationalNumber . length ( ) ) ; } }
converts numbertoparse to a form that we can parse and write it to nationalnumber if it is written in rfc3966 ; otherwise extract a possible number out of it and write to nationalnumber .
