private static boolean accepts(String accept_header,String to_accept){
  String[] acceptValues=accept_header.split("\\s*(,|;)\\s*");
  Arrays.sort(acceptValues);
  return Arrays.binarySearch(acceptValues,to_accept) > -1 || Arrays.binarySearch(acceptValues,to_accept.replaceAll("/.*$","/*")) > -1 || Arrays.binarySearch(acceptValues,"*/*") > -1;
}

private static boolean accepts ( String accept_header , String to_accept ) { String [ ] acceptValues = accept_header . split ( "\\s*(,|;)\\s*" ) ; Arrays . sort ( acceptValues ) ; return Arrays . binarySearch ( acceptValues , to_accept ) > - 1 || Arrays . binarySearch ( acceptValues , to_accept . replaceAll ( "/.*$" , "/*" ) ) > - 1 || Arrays . binarySearch ( acceptValues , "*/*" ) > - 1 ; }
returns true if the given accept header accepts the given value .
