Here you can find the source of touch(String file)
public static boolean touch(String file) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { /**//www. j av a2 s . c o m * Create a new empty file. */ public static boolean touch(String file) throws IOException { return !exists(file) && (new File(file)).createNewFile(); } /** * Check if a file exists. */ public static boolean exists(String file) { return (new File(file)).exists(); } }