public static String generateFileName(String string) {
        string = StringUtils.stripAccents(string);
        StringBuilder buf = new StringBuilder();
        for (int i = 0; i < string.length(); i++) {
            char c = string.charAt(i);
            if (Character.isSpaceChar(c)
                    && (buf.length() == 0 || Character.isSpaceChar(buf.charAt(buf.length() - 1)))) {
                continue;
            }
            if (ArrayUtils.contains(validChars, c)) {
                buf.append(c);
            }
        }
        String filename = buf.toString().trim();
        if (TextUtils.isEmpty(filename)) {
            return randomString(8);
        } else if (filename.length() >= MAX_FILENAME_LENGTH) {
            return filename.substring(0, MAX_FILENAME_LENGTH - MD5_HEX_LENGTH - 1) + "_" + md5(filename);
        } else {
            return filename;
        }
    }
@Test
    public void testGenerateFileName2() throws Exception {
        String result = FileNameGenerator.generateFileName("abc abc ");
        assertEquals(result, "abc abc");
        createFiles(result);
    }