This program detects the Mime type. Designate the file by writing a path of the file.
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class TestMime {
public static void main(String[] args) throws IOException {
Path source = Paths.get("c:/temp/0multipage.tif"); // Write a path of the file here.
System.out.println(Files.probeContentType(source));
// output : image/tiff
}
}