public String selectHeaderAccept(String[] accepts) {
    if (accepts.length == 0) return null;
    if (StringUtil.containsIgnoreCase(accepts, "application/json")) return "application/json";
    return StringUtil.join(accepts, ",");
  }
public String selectHeaderAccept(String[] accepts) {
    if (accepts.length == 0) return null;
    if (StringUtil.containsIgnoreCase(accepts, "application/json")) return "application/json";
    return StringUtil.join(accepts, ",");
  }
public String selectHeaderAccept ( String [ ] accepts ) { if ( accepts . length == 0 ) return null ; if ( StringUtil . containsIgnoreCase ( accepts , "application/json" ) ) return "application/json" ; return StringUtil . join ( accepts , "," ) ; }
Select the Accept header's value from the given accepts array:
if JSON exists in the given array, use it;
otherwise use all of them (joining into a string)

@param accepts The accepts array to select from
@return The Accept header to use. If the given array is empty,
null will be returned (not to set the Accept header explicitly).
Select the Accept header s value from the given accepts array : if JSON exists in the given array use it ; otherwise use all of them ( joining into a string )