Tell whether the given character is in the "high unicode" (four-byte) range. - Java java.lang

Java examples for java.lang:String Unicode

Description

Tell whether the given character is in the "high unicode" (four-byte) range.

Demo Code

//package com.java2s;

public class Main {
    public static void main(String[] argv) {
        int cNum = 42;
        System.out.println(isHighUnicode(cNum));
    }//from w w  w . ja v  a 2 s.  co m

    private static final int UC_LOW5 = 0x10000;
    private static final int UC_HIGH5 = 0x10FFFF;

    /**
     * Tell whether the given character is in the "high unicode" (four-byte) range.
     *
     * @param cNum the character.
     * @return true if it's a low unicode character.
     */
    private static boolean isHighUnicode(final int cNum) {
        return cNum >= UC_LOW5 && cNum <= UC_HIGH5;
    }
}

Related Tutorials