code: private static boolean accepts(String acceptHeader, String toAccept) {
          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;
      }
docs: Returns true if the given accept header accepts the given value.
  
  @param acceptHeader The accept header.
  @param toAccept The value to be accepted.
  @return True if the given accept header accepts the given value.