public String format(PhoneNumber number,PhoneNumberFormat numberFormat){
  if (number.getNationalNumber() == 0 && number.hasRawInput()) {
    String rawInput=number.getRawInput();
    if (rawInput.length() > 0) {
      return rawInput;
    }
  }
  StringBuilder formattedNumber=new StringBuilder(20);
  format(number,numberFormat,formattedNumber);
  return formattedNumber.toString();
}

public String format ( PhoneNumber number , PhoneNumberFormat numberFormat ) { if ( number . getNationalNumber ( ) == 0 && number . hasRawInput ( ) ) { String rawInput = number . getRawInput ( ) ; if ( rawInput . length ( ) > 0 ) { return rawInput ; } } StringBuilder formattedNumber = new StringBuilder ( 20 ) ; format ( number , numberFormat , formattedNumber ) ; return formattedNumber . toString ( ) ; }
formats a phone number in the specified format using default rules . note that this does not promise to produce a phone number that the user can dial from where they are - although we do format in either ' national ' or ' international ' format depending on what the client asks for , we do not currently support a more abbreviated format , such as for users in the same " area " who could potentially dial the number without area code . note that if the phone number has a country calling code of 0 or an otherwise invalid country calling code , we cannot work out which formatting rules to apply so we return the national significant number with no formatting applied .
