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

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