Example usage for java.lang Character MAX_VALUE

List of usage examples for java.lang Character MAX_VALUE

Introduction

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

Prototype

char MAX_VALUE

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

Click Source Link

Document

The constant value of this field is the largest value of type char , '\u005CuFFFF' .

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.SURROGATE == Character.getType(ch)) {

            String s = String.format("\\u%04x", (int) ch);
            System.out.println(s);
        }//w w w .j a  v  a2s.  co  m
    }
}

From source file:Main.java

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

            String s = String.format("\\u%04x", (int) ch);
            System.out.println(s);
        }/*from w  w w.  ja  va2 s . c  o m*/
    }
}

From source file:Main.java

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

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

From source file:Main.java

public static void main(String[] args) {
    System.out.println((int) Character.MIN_VALUE);
    System.out.println((int) Character.MAX_VALUE);
}

From source file:org.apache.hadoop.io.TestUTF8.java

public static String getTestString() throws Exception {
    StringBuffer buffer = new StringBuffer();
    int length = RANDOM.nextInt(1010);
    for (int i = 0; i < length; i++) {
        buffer.append((char) (RANDOM.nextInt(Character.MAX_VALUE)));
    }/* w w  w.  j a v a 2s. c  o  m*/
    return buffer.toString();
}

From source file:Main.java

/**
 * Serializes a Keystrike to a String./*from ww w .  j a v  a2  s .co  m*/
 * It can then be fed into KeyStroke.getKeyStroke(String).
 *
 * See: http://www.exampledepot.com/egs/javax.swing/Key2Str.html
 */
public static String keyStroke2String(KeyStroke key) {
    StringBuffer s = new StringBuffer(50);
    int m = key.getModifiers();

    if ((m & (InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK)) != 0) {
        s.append("shift ");
    }
    if ((m & (InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK)) != 0) {
        s.append("ctrl ");
    }
    if ((m & (InputEvent.META_DOWN_MASK | InputEvent.META_MASK)) != 0) {
        s.append("meta ");
    }
    if ((m & (InputEvent.ALT_DOWN_MASK | InputEvent.ALT_MASK)) != 0) {
        s.append("alt ");
    }
    if ((m & (InputEvent.BUTTON1_DOWN_MASK | InputEvent.BUTTON1_MASK)) != 0) {
        s.append("button1 ");
    }
    if ((m & (InputEvent.BUTTON2_DOWN_MASK | InputEvent.BUTTON2_MASK)) != 0) {
        s.append("button2 ");
    }
    if ((m & (InputEvent.BUTTON3_DOWN_MASK | InputEvent.BUTTON3_MASK)) != 0) {
        s.append("button3 ");
    }

    switch (key.getKeyEventType()) {
    case KeyEvent.KEY_TYPED:
        if (key.getKeyChar() == Character.MAX_VALUE) {
            s.append("unknown-typed-key ");
            break;
        }
        s.append("typed ").append(key.getKeyChar()).append(" ");
        break;
    case KeyEvent.KEY_PRESSED:
        s.append("pressed ").append(getKeyText(key.getKeyCode())).append(" ");
        break;
    case KeyEvent.KEY_RELEASED:
        s.append("released ").append(getKeyText(key.getKeyCode())).append(" ");
        break;
    default:
        s.append("unknown-event-type ");
        break;
    }

    return s.toString();
}

From source file:Main.java

private static char parseCharRef(String charRef) {
    if (charRef.length() >= 2 && charRef.charAt(0) == '#') {
        int i;/*from   w ww .  j a v a 2  s  . co m*/

        try {
            if (charRef.charAt(1) == 'x')
                i = Integer.parseInt(charRef.substring(2), 16);
            else
                i = Integer.parseInt(charRef.substring(1));
        } catch (NumberFormatException e) {
            i = -1;
        }

        if (i < 0 || i > Character.MAX_VALUE)
            return '?';
        else
            return (char) i;
    }
    if (charRef.equals("amp")) {
        return '&';
    }
    if (charRef.equals("apos")) {
        return '\'';
    }
    if (charRef.equals("quot")) {
        return '\"';
    }
    if (charRef.equals("lt")) {
        return '<';
    }
    if (charRef.equals("gt")) {
        return '>';
    } else {
        return '?';
    }
}

From source file:org.joda.primitives.iterator.impl.TestArrayCharIterator.java

@Override
public Iterator<Character> makeFullIterator() {
    char[] data = new char[] { new Character((char) 2), new Character('a'), new Character('@'),
            new Character('Z'), new Character((char) 5000), new Character((char) 202),
            new Character(Character.MIN_VALUE), new Character(Character.MAX_VALUE) };
    return new ArrayCharIterator(data);
}

From source file:marshalsec.gadgets.ToStringUtil.java

private static void unhash0(StringBuilder partial, int target) {
    int div = target / 31;
    int rem = target % 31;

    if (div <= Character.MAX_VALUE) {
        if (div != 0)
            partial.append((char) div);
        partial.append((char) rem);
    } else {/*  ww w  .  j  av  a2 s  . c o m*/
        unhash0(partial, div);
        partial.append((char) rem);
    }
}

From source file:org.joda.primitives.collection.impl.AbstractTestCharCollection.java

public Character[] getFullNonNullElements() {
    return new Character[] { new Character((char) 2), new Character('a'), new Character('@'),
            new Character('Z'), new Character((char) 5000), new Character((char) 202),
            new Character(Character.MIN_VALUE), new Character(Character.MAX_VALUE) };
}