code: private static int getSingleCP(CharSequence s) {
          if (s.length() < 1) {
              throw new IllegalArgumentException("Can't use zero-length strings in UnicodeSet");
          }
          if (s.length() > 2) return -1;
          if (s.length() == 1) return s.charAt(0);
  
          // at this point, len = 2
          int cp = UTF16.charAt(s, 0);
          if (cp > 0xFFFF) { // is surrogate pair
              return cp;
          }
          return -1;
      }
docs: Utility for getting code point from single code point CharSequence.
  See the public UTF16.getSingleCodePoint()
  @return a code point IF the string consists of a single one.
  otherwise returns -1.
  @param s to test