Clean a RandomAccessFile
<p>I have a code:</p>

<pre><code>for (int i = 1; i &lt;= Math.ceil(n/m); i++){
  RandomAccessFile file_1 = new RandomAccessFile(".\\src\\dataFiles\\fileC_" + i + ".dat", "r");
  RandomAccessFile index_1 = new RandomAccessFile(".\\src\\dataFiles\\indexC_" + i + ".dat", "r");  

  RandomAccessFile sumFile = new RandomAccessFile(".\\src\\dataFiles\\sumFile_" + i + ".dat", "rw");
  RandomAccessFile sumIndex = new RandomAccessFile(".\\src\\dataFiles\\sumIndex_" + i +".dat", "rw");

  for (int q = 0; q &lt; n; q++){
sumRow = Matrix.getString(file_1, index_1, q).plus(Matrix.getString(tempFile, tempIndex, q));
Matrix.writeLine(sumFile, sumIndex, sumRow);
  }

   tempFile = sumFile;
   tempIndex = sumIndex;    

   file_1.close();
   index_1.close();
}
</code></pre>

<p>As you can see, there are files and their indexes, which show where can I find necessary strings.
This part of a program do the addition of integers located in files. Files of type "file_1" I can close and then delete, but files of type "sumFile" can't, because I use referenes on them:</p>

<pre><code>tempFile = sumFile;
tempIndex = sumIndex;
</code></pre>

<p>If I knew how to clean a file, I would not create "sumFile"-files each time I need a sumFile. I would just clean it. Do you know, how to clean a RandomAccessFile???? The only way I know is to do so:</p>

<pre><code>File file = new File("path to a sumFile");
file.delete();
</code></pre>

<p>and then create a new file with even name.</p>
