code: public static IntArrayList getChildrenOf(int[] parents, int parent) {
          IntArrayList children = new IntArrayList();
          for (int i=0; i<parents.length; i++) {
              if (parents[i] == parent) {
                  children.add(i);
              }
          }
          return children;
      }
docs: Gets the children of the specified parent.
  @param parents A parents array.
  @param parent The parent for which the children should be  extracted.
  @return The indices of the children.