code: private IIOMetadataNode getNode(IIOMetadataNode rootNode, String nodeName) {
  
          IIOMetadataNode[] nodes = new IIOMetadataNode[rootNode.getLength()];
  
          for (int i = 0; i < rootNode.getLength(); i++) {
              nodes[i] = (IIOMetadataNode) rootNode.item(i);
          }
  
          return Arrays.stream(nodes)
                  .filter(n -> n.getNodeName().equalsIgnoreCase(nodeName))
                  .findFirst().orElseGet(() -> {
                      IIOMetadataNode node = new IIOMetadataNode(nodeName);
                      rootNode.appendChild(node);
                      return node;
                  });
      }
docs: Returns an existing child node, or creates and returns a new child node (if
  the requested node does not exist).
  
  @param rootNode the <tt>IIOMetadataNode</tt> to search for the child node.
  @param nodeName the name of the child node.
  @return the child node, if found or a new node created with the given name.