private static int findLowestAliveNodeIndex(TreePath path) {
    Object[] nodes = path.getPath();
    for (int i = 1; i < nodes.length; i++) {
      TreeNode node = (TreeNode) nodes[i];
      if (node.getParent() == null) return i - 1;
    }
    return nodes.length - 1;
  }
private static int findLowestAliveNodeIndex(TreePath path)