code: public static void copy(String fromFile, String toFile) throws IOException {
  
          File inputFile = new File(fromFile);
          File outputFile = new File(toFile);
          if (!outputFile.getParentFile().isDirectory()) {
              outputFile.getParentFile().mkdirs();
          }
          FileInputStream in = new FileInputStream(inputFile);
          FileOutputStream out = new FileOutputStream(outputFile);
  
          // transfer bytes from in to out
          byte[] buf = new byte[1024];
          int len;
          while ((len = in.read(buf)) > 0) {
              out.write(buf, 0, len);
          }
          in.close();
          out.close();
      }
docs: Simply version of a 1:1 binary file copy.<p>
  
  @param fromFile the name of the file to copy
  @param toFile the name of the target file
  @throws IOException if any IO error occurs during the copy operation