public static boolean createNewFile(File targetFile) {
        if (targetFile.exists()) delFileOrFolder(targetFile);
        try {
            return targetFile.createNewFile();
        } catch (IOException e) {
            return false;
        }
    }
public static boolean createNewFile ( File targetFile ) { if ( targetFile . exists ( ) ) delFileOrFolder ( targetFile ) ; try { return targetFile . createNewFile ( ) ; } catch ( IOException e ) { return false ; } }
Create a new file, if the file exists, delete and create again.

@param targetFile file.

@return True: success, or false: failure.