static public void copyFile(String fileName,String destFileName) throws IOException, FileNotFoundException {
  int ch;
  BufferedOutputStream bos;
  BufferedInputStream bis;
  bis=new BufferedInputStream(new FileInputStream(fileName));
  bos=new BufferedOutputStream(new FileOutputStream(destFileName));
  while ((ch=bis.read()) != -1)   bos.write(ch);
  bos.flush();
  bos.close();
  bis.close();
}

static public void copyFile ( String fileName , String destFileName ) throws IOException , FileNotFoundException { int ch ; BufferedOutputStream bos ; BufferedInputStream bis ; bis = new BufferedInputStream ( new FileInputStream ( fileName ) ) ; bos = new BufferedOutputStream ( new FileOutputStream ( destFileName ) ) ; while ( ( ch = bis . read ( ) ) != - 1 ) bos . write ( ch ) ; bos . flush ( ) ; bos . close ( ) ; bis . close ( ) ; }
coping certain file to destination file . example : copy c : / test / oldfile . txt c : / destdir / newfile . txt
