code: public static File substituteExtention( File file, String newExtention ) {
          String path = file.getAbsolutePath();
          int lastDot = path.lastIndexOf("."); //$NON-NLS-1$
          if (lastDot == -1) {
              path = path + "." + newExtention; //$NON-NLS-1$
          } else {
              path = path.substring(0, lastDot) + "." + newExtention; //$NON-NLS-1$
          }
          return new File(path);
      }
docs: Substitute the extention of a file.
  
  @param file         the file.
  @param newExtention the new extention (without the dot).
  
  @return the file with the new extention.