for (int i = 0; i < views.length; ++i) if (views[i] == null) throw new NullPointerException("Added views must not be null");
  public void replace(int offset, int length, View[] views)  {    // Make sure we have an array. The Harmony testsuite indicates that we    // have to do something like this.    if (views == null)      views = new View[0];    // Check for null views to add.    for (int i = 0; i < views.length; ++i)      if (views[i] == null)        throw new NullPointerException("Added views must not be null");    int endOffset = offset + length;    // First we set the parent of the removed children to null.    for (int i = offset; i < endOffset; ++i)      {        if (children[i].getParent() == this)      children[i].setParent(null);      }    View[] newChildren = new View[children.length - length + views.length];    System.arraycopy(children, 0, newChildren, 0, offset);    System.arraycopy(views, 0, newChildren, offset, views.length);    System.arraycopy(children, offset + length, newChildren,                     offset + views.length,                     children.length - (offset + length));    children = newChildren;    // Finally we set the parent of the added children to this.    for (int i = 0; i < views.length; ++i)      views[i].setParent(this);  }