code: public static void moveFile(File srcFile, File destFile) throws IOException {
      if (srcFile == null) {
        throw new NullPointerException("Source must not be null");
      }
      if (destFile == null) {
        throw new NullPointerException("Destination must not be null");
      }
      if (!srcFile.exists()) {
        throw new FileNotFoundException("Source '" + srcFile + "' does not exist");
      }
      if (srcFile.isDirectory()) {
        throw new IOException("Source '" + srcFile + "' is a directory");
      }
      if (destFile.exists()) {
        throw new FileExistsException("Destination '" + destFile + "' already exists");
      }
      if (destFile.isDirectory()) {
        throw new IOException("Destination '" + destFile + "' is a directory");
      }
      boolean rename = srcFile.renameTo(destFile);
      if (!rename) {
        copyFile( srcFile, destFile );
        if (!srcFile.delete()) {
          FileUtils.deleteQuietly(destFile);
          throw new IOException("Failed to delete original file '" + srcFile +
              "' after copy to '" + destFile + "'");
        }
      }
    }
docs: Moves a file.
  <p>
  When the destination file is on another file system, do a "copy and delete".
  
  @param srcFile the file to be moved
  @param destFile the destination file
  @throws NullPointerException if source or destination is <code>null</code>
  @throws FileExistsException if the destination file exists
  @throws IOException if source or destination is invalid
  @throws IOException if an IO error occurs moving the file
  @since 1.4