### Question:
CharacterSet extends ArrayList<CharacterRange> { public boolean contains(int charCode) { boolean found = false; for (int i = 0; !found && i < size(); i++) { CharacterRange range = get(i); if (range.characterSet != null) { found = range.characterSet.contains(String.valueOf((char)charCode)); } else { found = charCode >= range.start && charCode <= range.end; } } return found; } CharacterSet();  CharacterSet(int size); boolean contains(int charCode);  }### Answer:
@Test public void testContainsChar() { CharacterSet set = new CharacterSet(); set.add(new CharacterRange("ABC")); set.add(new CharacterRange("XyZ")); assertTrue("A", set.contains("A".codePointAt(0))); assertTrue("B", set.contains("B".codePointAt(0))); assertTrue("C", set.contains("C".codePointAt(0))); assertTrue("X", set.contains("X".codePointAt(0))); assertTrue("y", set.contains("y".codePointAt(0))); assertTrue("Z", set.contains("Z".codePointAt(0))); assertFalse("a", set.contains("a".codePointAt(0))); assertFalse("Y", set.contains("Y".codePointAt(0))); assertFalse("P", set.contains("P".codePointAt(0))); set = new CharacterSet(); set.add(new CharacterRange(65, 67)); set.add(new CharacterRange(88, 88)); set.add(new CharacterRange(121, 121)); set.add(new CharacterRange(90, 90)); assertTrue("A", set.contains("A".codePointAt(0))); assertTrue("B", set.contains("B".codePointAt(0))); assertTrue("C", set.contains("C".codePointAt(0))); assertTrue("X", set.contains("X".codePointAt(0))); assertTrue("y", set.contains("y".codePointAt(0))); assertTrue("Z", set.contains("Z".codePointAt(0))); assertFalse("a", set.contains("a".codePointAt(0))); assertFalse("Y", set.contains("Y".codePointAt(0))); assertFalse("P", set.contains("P".codePointAt(0))); }