public class Demo12 { public static void main(String[] args) throws IOException { File file=new File("1.txt"); FileInputStream fis=new FileInputStream(file); FileOutputStream fos=new FileOutputStream(new File("4.txt")); byte[] bt=new byte[1024]; int count; while((count=fis.read(bt))!=-1) { fos.write(bt,0,count); } fis.close(); fos.close(); } }