boolean (int cur, int prev) { if (!maybeKana(cur) && !maybeKana(prev)) return false; Character.UnicodeScript curScript = Character.UnicodeScript.of(cur); Character.UnicodeScript prevScript = Character.UnicodeScript.of(prev); if (prevScript == curScript) return false; return (curScript == Character.UnicodeScript.KATAKANA || curScript == Character.UnicodeScript.HIRAGANA || prevScript == Character.UnicodeScript.KATAKANA || prevScript == Character.UnicodeScript.HIRAGANA) && prevScript != Character.UnicodeScript.COMMON && curScript != Character.UnicodeScript.COMMON; }