code: public static void removeLastChild(Element tag) {
      final Node last = tag.getLastChild();
      if(last != null) {
        tag.removeChild(last);
      }
    }
docs: Remove last child of an element, when present
  
  @param tag Parent