code: public String format()
      {
          if (mFormatted != null)
          {
              return mFormatted;
          }
  
          // userid:password
          String credentials = String.format("%s:%s",
                  mUserId   == null ? "" : mUserId,
                  mPassword == null ? "" : mPassword);
  
          // Convert the credentials into a byte array.
          byte[] credentialsBytes = getBytes(credentials);
  
          // Encode the byte array by Base64.
          String encoded = Base64.encodeBase64String(credentialsBytes);
  
          // Build the value of Authorization header.
          mFormatted = "Basic " + encoded;
  
          return mFormatted;
      }
docs: Create a value suitable as the value of {@code Authorization} header.
  
  @return
  {@code Authorization} header value for Basic authentication.