public static boolean cleanDirectory(File dir) {
        if (dir.isDirectory()) {
            String[] children = dir.list();
            if (children != null) {
                for (String aChildren : children) {
                    boolean success = cleanDirectory(new File(dir, aChildren));
                    if (!success) {
                        return false;
                    }
                }
            }
        }
        return dir.delete();
    }
@Test
    public void cleanDirectory() throws Exception {
        String filePath = System.getProperty("java.io.tmpdir") + File.separator
            + "FileTest" + 1;
        FileUtils.string2File(new File(filePath, "xx.tmp"), "helloworld!");
        Assert.assertTrue(new File(filePath, "xx.tmp").exists());

        String ct = FileUtils.file2String(new File(filePath, "xx.tmp"));
        Assert.assertTrue(ct.equals("helloworld!"));

        List<String> datas = FileUtils.readLines(new File(filePath, "xx.tmp"));
        Assert.assertTrue(datas.size() == 1);

        FileUtils.cleanDirectory(new File(filePath));
        Assert.assertFalse(new File(filePath).exists());
    }