public String selectHeaderContentType(String[] contentTypes) {
    if (contentTypes.length == 0) return "application/json";
    if (StringUtil.containsIgnoreCase(contentTypes, "application/json")) return "application/json";
    return contentTypes[0];
  }
public String selectHeaderContentType(String[] contentTypes) {
    if (contentTypes.length == 0) return "application/json";
    if (StringUtil.containsIgnoreCase(contentTypes, "application/json")) return "application/json";
    return contentTypes[0];
  }
public String selectHeaderContentType ( String [ ] contentTypes ) { if ( contentTypes . length == 0 ) return "application/json" ; if ( StringUtil . containsIgnoreCase ( contentTypes , "application/json" ) ) return "application/json" ; return contentTypes [ 0 ] ; }
Select the Content-Type header's value from the given array:
if JSON exists in the given array, use it;
otherwise use the first one of the array.

@param contentTypes The Content-Type array to select from
@return The Content-Type header to use. If the given array is empty,
JSON will be used.
Select the Content - Type header s value from the given array : if JSON exists in the given array use it ; otherwise use the first one of the array .