code: private void readObject(java.io.ObjectInputStream s)
          throws java.io.IOException, ClassNotFoundException {
          elementData = EMPTY_ELEMENTDATA;
  
          // Read in size, and any hidden stuff
          s.defaultReadObject();
  
          // Read in capacity
          s.readInt(); // ignored
  
          if (size > 0) {
              // be like clone(), allocate array based upon size not capacity
              ensureCapacityInternal(size);
  
              Object[] a = elementData;
              // Read in all elements in the proper order.
              for (int i=0; i<size; i++) {
                  a[i] = s.readObject();
              }
          }
      }
docs: Reconstitute the <tt>ArrayList</tt> instance from a stream (that is,
  deserialize it).