FileBackupCreate.java
import java.util.*; import java.io.*; class FileBackupCreate { public static void main(String[] args) throws FileNotFoundException, IOException { FileInputStream fis = null; FileOutputStream fos = null; int fileSize = 0, data = 0; fis = new FileInputStream(args[0]); fileSize = fis.available(); if (fileSize == 0) { System.out.println("Sorry, this file is empty."); fis.close(); return; } fos = new FileOutputStream(args[0] + ".bak"); while ( (data = fis.read()) != -1) { fos.write(data); } fos.flush(); System.out.println("Backup file craeted successfully."); fos.close(); fis.close(); } }