Get file extension on Spring

Get file extension on Spring and Java:

package com.yamicode.file.utils;

import org.springframework.web.multipart.MultipartFile;

@Component
public class FilesUtil {

  public static String getFileExtension(MultipartFile file) {
    String orgName = file.getOriginalFilename();
    String[] parts = orgName.split("\\.");
    String extension = parts[parts.length-1];
    return extension;
  }
}