code: public static File copyFile(String source, String target) throws IOException {
          FileChannel inputChannel = null;
          FileChannel outputChannel = null;
          try {
              inputChannel = new FileInputStream(source).getChannel();
              outputChannel = new FileOutputStream(target).getChannel();
              outputChannel.transferFrom(inputChannel, 0, inputChannel.size());
          } finally {
              if (inputChannel != null) {
                  inputChannel.close();
              }
              if (outputChannel != null) {
                  outputChannel.close();
              }
          }
          return new File(target);
      }
docs: Copies source file to target.
  
  @param source source file to copy.
  @param target destination to copy to.
  @return target as File.
  @throws IOException when unable to copy.