public static void main(String [] args) throws IOException{
try(
FileInputStream fis = new FileInputStream ("xxx.txt");
FileOutputStream fos = new FileOutputStream("yyy.txt");
){
int b ;
while((b = fis.read() ) != -1) {
fos.write(b);
}
}
}