code: public static boolean isLegal(int ch)
      {
          if (ch < MIN_VALUE) {
              return false;
          }
          if (ch < Character.MIN_SURROGATE) {
              return true;
          }
          if (ch <= Character.MAX_SURROGATE) {
              return false;
          }
          if (UCharacterUtility.isNonCharacter(ch)) {
              return false;
          }
          return (ch <= MAX_VALUE);
      }
docs: <strong>[icu]</strong> A code point is illegal if and only if
  <ul>
  <li> Out of bounds, less than 0 or greater than UCharacter.MAX_VALUE
  <li> A surrogate value, 0xD800 to 0xDFFF
  <li> Not-a-character, having the form 0x xxFFFF or 0x xxFFFE
  </ul>
  Note: legal does not mean that it is assigned in this version of Unicode.
  @param ch code point to determine if it is a legal code point by itself
  @return true if and only if legal.