code: public static int indexOfNull (Object[] list)
      {
          if (list != null) {
              for (int ii=0, nn = list.length; ii < nn; ii++) {
                  if (list[ii] == null) {
                      return ii;
                  }
              }
          }
          return -1;
      }
docs: Returns the lowest index in the array that contains null,
  or -1 if there is no room to add elements without expanding the array.