Example usage for java.lang Character MIN_SURROGATE

List of usage examples for java.lang Character MIN_SURROGATE

Introduction

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

Prototype

char MIN_SURROGATE

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

Click Source Link

Document

The minimum value of a Unicode surrogate code unit in the UTF-16 encoding, constant '\u005CuD800' .

Usage

From source file:Main.java

public static void main(String[] args) {
    System.out.println("Character.MIN_SURROGATE:" + (int) Character.MIN_SURROGATE);
}

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 ww w .  j  a va  2  s  .  co  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;
        }// w  w  w . j ava2 s .com
        // 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;
}