public static void copyFile(File source, File destination) throws IOException {
       if (destination.exists())
           destination.delete();

       FileChannel sourceChannel = null;
       FileChannel destinationChannel = null;

       try {
           sourceChannel = new FileInputStream(source).getChannel();
           destinationChannel = new FileOutputStream(destination).getChannel();
           sourceChannel.transferTo(0, sourceChannel.size(),
                   destinationChannel);
       } finally {
           if (sourceChannel != null && sourceChannel.isOpen())
               sourceChannel.close();
           if (destinationChannel != null && destinationChannel.isOpen())
               destinationChannel.close();
      }
  }