public static boolean isPunctuationCodePoint(int codePoint) {
        switch (Character.getType(codePoint)) {
            // General category "P" (punctuation)
            case Character.DASH_PUNCTUATION:
            case Character.START_PUNCTUATION:
            case Character.END_PUNCTUATION:
            case Character.CONNECTOR_PUNCTUATION:
            case Character.OTHER_PUNCTUATION:
            case Character.INITIAL_QUOTE_PUNCTUATION:
            case Character.FINAL_QUOTE_PUNCTUATION:
                // General category "S" (symbol)
            case Character.MATH_SYMBOL:
            case Character.CURRENCY_SYMBOL:
            case Character.MODIFIER_SYMBOL:
            case Character.OTHER_SYMBOL:
                return true;
            default:
                switch (codePoint) {
                    case '$':
                    case '+':
                    case '<':
                    case '=':
                    case '>':
                    case '^':
                    case '`':
                    case '|':
                    case '~':
                        return true;
                    default:
                        return false;
                }
        }
    }
@Test
    public void isPunctuation() {
        // From https://spec.commonmark.org/0.29/#ascii-punctuation-character
        char[] chars = {
                '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', // (U+0021–2F)
                ':', ';', '<', '=', '>', '?', '@', // (U+003A–0040)
                '[', '\\', ']', '^', '_', '`', // (U+005B–0060)
                '{', '|', '}', '~' // (U+007B–007E)
        };

        for (char c : chars) {
            assertTrue("Expected to be punctuation: " + c, Characters.isPunctuationCodePoint(c));
        }
    }