Can anyone tell me what's wrong with my code? Since the third condition ("The contents of every file that is 50 bytes or smaller must be sorted by file name and written to the allFilesContent.txt file.") passes, you would think the first and second condition must pass as well. As for the fourth condition, the try-with-resources block should be auto-closing the streams anyway.