public static File addExtension(File file,String extension){
  if (extension.startsWith(".")) {
    return new File(file.getAbsolutePath() + extension);
  }
 else {
    return new File(file.getAbsolutePath() + "." + extension);
  }
}

public static File addExtension ( File file , String extension ) { if ( extension . startsWith ( "." ) ) { return new File ( file . getAbsolutePath ( ) + extension ) ; } else { return new File ( file . getAbsolutePath ( ) + "." + extension ) ; } }
append an extension to a file . if extension does not contain a dot , it will be automatically added
