public static String toJavaIdentifierString(String className)
    {
        // replace invalid characters with '_'
        return CharMatcher.forPredicate(Character::isJavaIdentifierPart).negate()
                .replaceFrom(className, '_');
    }
@Test
    public void testToJavaIdentifierString()
    {
        assertEquals(toJavaIdentifierString("HelloWorld"), "HelloWorld");
        assertEquals(toJavaIdentifierString("Hello$World"), "Hello$World");
        assertEquals(toJavaIdentifierString("Hello#World"), "Hello_World");
        assertEquals(toJavaIdentifierString("A^B^C"), "A_B_C");
    }