The output its correct, i think the problem is the requirement: Only use classes and methods from the java.nio package. But i dont know how to do thi task in a different way Or maybe its because im using recursion?