is it possible for delete file without new file instance in Java?
<p>I have a simple function used for file delete, </p>

<p>it will check the file size,</p>

<p>if small than a specific value, delete the file</p>

<p>however, this function will be called thousand times</p>

<p>and every time it will new file instance, </p>

<p>i think it will be expensive on file object creation issue, </p>

<p>is there any other way to fix this issue?</p>

<pre><code>public void checkFile(String filePath) {
    File file = new File(filePath); //this is expensive
    if (file.length() &lt; 500) {
         file.delete();
    }
}
</code></pre>
