public static List<Path> listAllJarsUnderDirectory(Path directory) throws IOException {

        long startTime = System.nanoTime();

        Deque<Path> stack = new ArrayDeque<Path>();
        List<Path> files = new LinkedList<>();

        if (directory.isAbsolute() && Files.isDirectory(directory)) {
            stack.push(directory);

            while (stack.size() > 0) {
                DirectoryStream<Path> stream = Files.newDirectoryStream(stack.pop());
                for (Path p : stream) {
                    if (Files.isDirectory(p)) {
                        stack.push(p);
                    } else if (Utils.isJarFile(p)) {
                        files.add(p);
                    }
                }
            }
        }
        System.out.println(files.size() + " jars listed");
        long endTime = System.nanoTime();
        System.out.println("Execution time for method listAllJarsUnderDirectory() = " + (endTime - startTime) / 1000000000.0);

        return files;
    }