private static File ensureSuffix(File file,String suffix){
  String fileName=file.getName();
  if (!fileName.endsWith(suffix)) {
    fileName+="." + suffix;
    return new File(file.getParent(),fileName);
  }
 else {
    return file;
  }
}

private static File ensureSuffix ( File file , String suffix ) { String fileName = file . getName ( ) ; if ( ! fileName . endsWith ( suffix ) ) { fileName += "." + suffix ; return new File ( file . getParent ( ) , fileName ) ; } else { return file ; } }
modifies the name of the given file if necessary to ensure that it has the given suffix .
