Check out example codes for "java create file if not exists". It will help you in understanding the concepts better.

Code Example 1

String yourFile = "YourFile.txt";
String yourContent = "YourContent"

File tmpDir = new File(yourFile);
boolean exists = tmpDir.exists();

if(!exists) {
	FileOutputStream fos = new FileOutputStream(yourFile);
	fos.write(yourContent.getBytes());
	fos.flush();
	fos.close();
}

Learn ReactJs, React Native from akashmittal.com