Check if file exists without creating it
<p>If I do this:</p>

<pre><code>  File f = new File("c:\\text.txt");

      if(f.exists()){
          System.out.println("File exists");
      }else{
          System.out.println("File not found!");
      }
</code></pre>

<p>Then the file gets created and always returns "File exists". Is it possible to check if a file exists without creating it?</p>

<p><strong>EDIT 1:</strong></p>

<p>Okay I forgot to mention that it's in a for loop. So here's the real thing:</p>

<pre><code>for (int i = 0; i &lt; 10; i++) {
     File file = new File("c:\\text" + i + ".txt");
     System.out.println("New file created: " + file.getPath());
}
</code></pre>
