Java file analyzer byte-by-byte
Replace

try (FileInputStream fis = new FileInputStream(file)) {


with

try (InputStream fis = new BufferedInputStream(new FileInputStream(file))) {


See also Why is using BufferedInputStream to read a file byte by byte faster than using FileInputStream?