code: public float qualityFactor(float defaultValueIfNotSpecified) {
          // Find 'q' or 'Q'.
          final List<String> qValues = parameters().get(Q);
          if (qValues == null || qValues.isEmpty()) {
              // qvalue does not exist.
              return defaultValueIfNotSpecified;
          }
  
          try {
              // Parse the qvalue. Make sure it's within the range of [0, 1].
              return Math.max(Math.min(Float.parseFloat(qValues.get(0)), 1.0f), 0.0f);
          } catch (NumberFormatException e) {
              // The range with a malformed qvalue gets the lowest possible preference.
              return 0.0f;
          }
      }
docs: Returns the quality factor of this {@link MediaType}. If it is not specified,
  {@code defaultValueIfNotSpecified} will be returned.