XMLChar { public static int supplemental(char h, char l) { return (h - 0xD800) * 0x400 + (l - 0xDC00) + 0x10000; }  static boolean isSupplemental(int c); static int supplemental(char h, char l); static char highSurrogate(int c); static char lowSurrogate(int c); static boolean isHighSurrogate(int c); static boolean isLowSurrogate(int c); static boolean isValid(int c); static boolean isInvalid(int c); static boolean isContent(int c); static boolean isMarkup(int c); static boolean isSpace(int c); static boolean isNameStart(int c); static boolean isName(int c); static boolean isNCNameStart(int c); static boolean isNCName(int c); static boolean isPubid(int c); static boolean isValidName(String name); static boolean isValidNCName(String ncName); static boolean isValidNmtoken(String nmtoken); static final int MASK_VALID; static final int MASK_SPACE; static final int MASK_NAME_START; static final int MASK_NAME; static final int MASK_PUBID; static final int MASK_CONTENT; static final int MASK_NCNAME_START; static final int MASK_NCNAME; }
@Test public void testSupplemental() { char h = (char)0xD801; char l = (char)0xDC02; int supplemental = 0x400 + 2 + 0x10000; assertEquals(new Integer(supplemental), new Integer(XMLChar.supplemental(h, l))); assertEquals(new Character(h), new Character(XMLChar.highSurrogate(supplemental))); assertEquals(new Character(l), new Character(XMLChar.lowSurrogate(supplemental))); }