var dirPath = Paths.get("C:\\tmp", "sample"); //The path to be tested.
if (dirPath.toFile().isDirectory()) { //Check if the directory exists.
    try (Stream<Path> entries = Files.list(dirPath)) {
        if (entries.findFirst().isEmpty()) {
            System.out.printf("%s is empty.", dirPath);
        }
    }
}