Reading file and print it in hex format really slow
Writing to the console is incredibly slow.... it also bit me in the past :)

Console is not really meant to print such big data anyway. What's your use case ?



Performance tuning

To reduce the impact on performance, you should try to reduce the number of call to System.out.print(set) to only one, at the end of the run....

You may end with a very big String however, so you should use a StringBuilder instead.

Combining both those things should reduce the time taken by your application by a very noticeable amount and you should end up with something looking like this :

StringBuilder sb = new StringBuilder();
// some more code
try (RandomAccessFile aFile = new RandomAccessFile("filePath", "r")) {
        FileChannel inChannel = aFile.getChannel();
        MappedByteBuffer buffer = inChannel.map(FileChannel.MapMode.READ_ONLY, 0, inChannel.size());
        for (int i = 0; i &lt; buffer.limit(); i++) {
            final byte read = buffer.get();
            sb.append((String.format("%02X ", read)));
            sb.append("\n");
        }
}


To ((very) slighlty) improve performance you may give your StringBuilder a big starting size like this :

StringBuilder sb = new StringBuilder(1_000_000);


Of course, you should prefer a well named constant over this ugly 1000000.

Other things in the code

Now that we are done with the performance aspect :
1. the name aFile is not really good looking IMO.
2. there is two nested try clause within each other but it's useless here.
3. please never user empty catch block :'(

After all those tweaks : it takes my computer 1 minute and a half to read a 28.5 mb file.