code: public void writeState(DataOutputStream stream) throws IOException
          {
          int len = mt.length;
          for(int x=0;x<len;x++) stream.writeInt(mt[x]);
          
          len = mag01.length;
          for(int x=0;x<len;x++) stream.writeInt(mag01[x]);
          
          stream.writeInt(mti);
          stream.writeDouble(__nextNextGaussian);
          stream.writeBoolean(__haveNextNextGaussian);
          }
docs: Writes the entire state of the MersenneTwister RNG to the stream
  @param stream
  @throws IOException