Traversing a tree to a given depth without using recursion.
Write a Java console application that takes three parameters: - path to the initial directory (rootPath) - search depth - non-negative integer (depth) - mask - string (mask)
The application should find all the elements of the file system tree located at depth depth from the root of the rootPath tree, which in their name contain the string mask. Requirements: - The application must be implemented WITHOUT using recursion. - The application should not be dependent on the OS.
Assistance is needed in solving this algorithm, especially in implementing the search for the required files to a predetermined depth.