Example usage for java.lang Character MAX_CODE_POINT

List of usage examples for java.lang Character MAX_CODE_POINT

Introduction

In this page you can find the example usage for java.lang Character MAX_CODE_POINT.

Prototype

int MAX_CODE_POINT

To view the source code for java.lang Character MAX_CODE_POINT.

Click Source Link

Document

The maximum value of a <a href="http://www.unicode.org/glossary/#code_point"> Unicode code point</a>, constant U+10FFFF .

Usage

From source file:Main.java

public static void main(String[] args) {
    for (char ch = Character.MIN_VALUE; ch < Character.MAX_VALUE; ch++) {
        if (Character.MAX_CODE_POINT == Character.getType(ch)) {

            String s = String.format("\\u%04x", (int) ch);
            System.out.println(s);
        }//from www .  ja v  a  2  s.co m
    }
}

From source file:Main.java

public static int[] generateCodePointSet(final int codePointSetSize, final Random random) {
    final int[] codePointSet = new int[codePointSetSize];
    for (int i = codePointSet.length - 1; i >= 0;) {
        final int r = Math.abs(random.nextInt());
        if (r < 0)
            continue;
        // Don't insert 0~0x20, but insert any other code point.
        // Code points are in the range 0~0x10FFFF.
        final int candidateCodePoint = 0x20 + r % (Character.MAX_CODE_POINT - 0x20);
        // Code points between MIN_ and MAX_SURROGATE are not valid on their own.
        if (candidateCodePoint >= Character.MIN_SURROGATE && candidateCodePoint <= Character.MAX_SURROGATE)
            continue;
        codePointSet[i] = candidateCodePoint;
        --i;/*from w w  w  .j  a  v a 2 s.  c  o m*/
    }
    return codePointSet;
}

From source file:Main.java

@Nonnull
public static int[] generateCodePointSet(final int codePointSetSize, @Nonnull final Random random) {
    final int[] codePointSet = new int[codePointSetSize];
    for (int i = codePointSet.length - 1; i >= 0;) {
        final int r = Math.abs(random.nextInt());
        if (r < 0) {
            continue;
        }//from  ww  w .j  av a2  s . c o  m
        // Don't insert 0~0x20, but insert any other code point.
        // Code points are in the range 0~0x10FFFF.
        final int candidateCodePoint = 0x20 + r % (Character.MAX_CODE_POINT - 0x20);
        // Code points between MIN_ and MAX_SURROGATE are not valid on their own.
        if (candidateCodePoint >= Character.MIN_SURROGATE && candidateCodePoint <= Character.MAX_SURROGATE) {
            continue;
        }
        codePointSet[i] = candidateCodePoint;
        --i;
    }
    return codePointSet;
}

From source file:com.turo.pushy.apns.util.ApnsPayloadBuilderBenchmark.java

@Setup
public void setUp() {
    this.apnsPayloadBuilder = new ApnsPayloadBuilder();

    final char[] messageBodyCharacters;
    {//from w  ww  .  j  ava  2 s  .c o m
        final Character.UnicodeBlock unicodeBlock = Character.UnicodeBlock.forName(this.unicodeBlockName);
        final List<Character> charactersInBlock = new ArrayList<>();

        for (int codePoint = Character.MIN_CODE_POINT; codePoint < Character.MAX_CODE_POINT; codePoint++) {
            if (unicodeBlock.equals(Character.UnicodeBlock.of(codePoint))
                    && !Character.isISOControl(codePoint)) {
                charactersInBlock.add((char) codePoint);
            }
        }

        messageBodyCharacters = new char[charactersInBlock.size()];

        for (int i = 0; i < charactersInBlock.size(); i++) {
            messageBodyCharacters[i] = charactersInBlock.get(i);
        }
    }

    this.messageBody = RandomStringUtils.random(this.messageBodyLength, messageBodyCharacters);
}

From source file:org.marketcetera.util.misc.RandomStrings.java

/**
 * Returns a randomly generated Unicode code point within the
 * full range of valid Unicode scalar values.
 *
 * @return The code point./*from   w w  w .  jav  a 2s  . c om*/
 */

public static int genUCP() {
    return sGenerator.nextInt(Character.MAX_CODE_POINT - Character.MIN_CODE_POINT + 1)
            + Character.MIN_CODE_POINT;
}

From source file:org.exoplatform.cms.common.CommonUtils.java

private static void getValueTokens() {
    if (tokens.size() <= 0) {
        String token;//from  w  ww . ja  v  a 2s  .com
        // Tokens by HTML(Decimal) code.
        for (int t = Character.MIN_CODE_POINT; t < Character.MAX_CODE_POINT; t++) {
            if (t < CHAR_CODES[0] && t > CHAR_CODES[1] || t < CHAR_CODES[2] && t > CHAR_CODES[3]
                    || t < CHAR_CODES[4] && t > CHAR_CODES[5] || t < CHAR_CODES[6] && t > CHAR_CODES[7]) {
                token = new StringBuilder(AMP_NUMBER).append(t).append(SEMICOLON).toString();
                tokens.add(token);
                charcodes.put(token, String.valueOf(Character.toChars(t)[0]));
            }
        }
        // Tokens by Entity code.
        tokens.add(LESS_THAN);
        charcodes.put(LESS_THAN, ">");
        tokens.add(GREATER_THAN);
        charcodes.put(GREATER_THAN, "<");
        tokens.add(QUOT);
        charcodes.put(QUOT, "\"");
        tokens.add(AMP_SPACE);
        charcodes.put(AMP_SPACE, SPACE);
        tokens.add(AMP_HEX);
        charcodes.put(AMP_HEX, "&");
        tokens.add(AMP);
        charcodes.put(AMP, "&");
    }
}

From source file:ca.oson.json.Oson.java

private Character long2Character(long longvalue, Long min, Long max) {
    Character valueToReturn;// www  .  ja  v a 2s.  c o m

    if (min == null && longvalue < Character.MIN_CODE_POINT) {
        valueToReturn = null;
    } else if (max == null && longvalue > Character.MAX_CODE_POINT) {
        valueToReturn = null;
    } else if (min != null && min > longvalue) {
        valueToReturn = (char) min.intValue();

    } else if (max != null && max < longvalue) {
        valueToReturn = (char) max.intValue();
    } else {
        valueToReturn = (char) longvalue;
    }

    return valueToReturn;

}