import java.io.*;
public class image {
public static void copy1() throws Exception {
FileInputStream fis = new FileInputStream("C:\\Users\\dell\\Pictures\\lock\\green.jpg");
FileOutputStream fos = new FileOutputStream("C:\\Users\\dell\\Pictures\\Saved Pictures\\dd.jpg");
byte[] bytes = new byte[1024 * 3];
int number = 0;
while ((number = fis.read(bytes)) != -1) {
fos.write(bytes);
}
fis.close();
fos.close();
}
public static void copy2() throws Exception {
BufferedInputStream bis = new BufferedInputStream(new FileInputStream("G:\\JavaStu\\qq.jpg"));
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("F:\\ppcc.jpg"));
int length = 0;
while ((length = bis.read()) != -1) {
bos.write(length);
}
bis.close();
bos.close();
}
public static void main(String[] args) throws Exception {
copy1();
copy2();
}
}