code: public String reorderToTop(String content, String selector, int amount,
  			String wrapRemaining) {
  
  		// extract the elements and then prepend them to the remaining body
  		List<Element> extracted = extractElements(content, selector, amount);
  
  		if (extracted.size() > 1) {
  
  			Element body = extracted.get(0);
  			
  			if (wrapRemaining != null) {
  				wrapInner(body, wrapRemaining);
  			}
  			
  			List<Element> elements = extracted.subList(1, extracted.size());
  
  			// now prepend extracted elements to the body (in backwards to preserve original order)
  			for (int index = elements.size() - 1; index >= 0; index--) {
  				body.prependChild(elements.get(index));
  			}
  
  			return body.html();
  		} else {
  			// nothing to reorder
  			return content;
  		}
  	}
docs: Reorders elements in HTML content so that selected elements are found at the top of the
  content. Can be limited to a certain amount, e.g. to bring just the first of selected
  elements to the top.
  
  @param content
  HTML content to reorder
  @param selector
  CSS selector for elements to bring to top of the content
  @param amount
  Maximum number of elements to reorder
  @param wrapRemaining
  HTML to wrap the remaining (non-reordered) part
  @return HTML content with reordered elements, or the original content if no such elements
  found.
  @since 1.0