Here you can find the source of createFile(String path)
public static boolean createFile(String path)
//package com.java2s; import java.io.File; public class Main { public static boolean createFile(String path) { File file = new File(path); try {//from ww w. j a va2 s . c o m if (file.exists()) { if (file.delete()) { file.createNewFile(); } } else { file.createNewFile(); } } catch (Exception e) { e.printStackTrace(); } return file.exists(); } }