code: public static String getFileExtension(File file) {
  
  		String fileName = file.getName();
  		String extension = null;
  
  		int extensionIndex = fileName.lastIndexOf(".");
  		if (extensionIndex > -1) {
  			extension = fileName.substring(extensionIndex + 1);
  		}
  
  		return extension;
  	}
docs: Get the file extension
  
  @param file
  file
  @return extension