Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个文件夹,其中存储了相机拍摄的图像,但该文件夹不应包含超过 8 张图像。这个怎么做?
只需传递目录的绝对路径,该方法将检查文件夹中是否有 r 8 个文件。
public boolean checkFilesInDirectory(String DirectoryPath) { File f = new File(DirectoryPath); f.mkdirs(); File[] files = f.listFiles(); if (files.length == 8) return true; else return false; }