class Symbol {

  public static String java2Elisp(String javaName) {

    StringBuffer lispName        = new StringBuffer();
    boolean      lastCharWasDash = false;
    char         prev            = ' ';

    for (int i = 0; i < javaName.length(); i++) {

      char c = javaName.charAt(i);

      if (!Character.isLetterOrDigit(c)) {
        lispName.append('-');
        lastCharWasDash = true;
      } else {
        // add in a dash only if the last character was not a dash and we
        // didn't undergo a case change from lower to upper case
        if (i > 0 && !lastCharWasDash
            && Character.isLetter(prev)
            && Character.isLetter(c)
            && Character.isLowerCase(prev)
            && Character.isUpperCase(c)) {
          lispName.append('-');
        }

        lispName.append(Character.toLowerCase(c));
        lastCharWasDash = false;
      }
      prev = c;
    }

    return lispName.toString();
  }

}

class SymbolTest {

    @Test
    public void testJava2Elisp2() {

        assertEquals("jdee-foo-call-left-right", Symbol.java2Elisp("jdee.foo.Call.leftRight"));
    }

}