Java Utililty Methods Char Create

List of utility methods to do Char Create

Description

The list of methods to do Char Create are organized into topic(s).

Method

CharactertoCharacter(Object object)
to Character
if (object == null)
    return '\u0beb';
else
    return (Character) object;
CharactertoCharacter(Object value)
to Character
if (value instanceof String && !((String) value).isEmpty()) {
    return ((String) value).toCharArray()[0];
return null;
chartoCharacter(String input, char defaultValue)
to Character
if (input == null) {
    return defaultValue;
if (input.length() == 1) {
    return input.charAt(0);
} else {
    return defaultValue;
StringtoCharacter(String str, String charset)
to Character
if (str != null && !str.equals("")) {
    try {
        return new String(str.getBytes("ISO8859-1"), charset);
    } catch (Exception var3) {
        var3.printStackTrace();
        return "";
} else {
...
StringtoCharCode(String s)
Returns a string representing the Unicode character codes of the characters comprising the string s.
StringBuilder sb = new StringBuilder(s.length());
for (int i = 0; i < s.length(); i++) {
    sb.append(s.codePointAt(i));
return sb.toString();
StringtoCharListNumber(int value, String list)
Create a string which represents the specified value using the specified list of characters.
if (value < 1) {
    throw new IllegalArgumentException("value");
int pos = 16;
char[] tmp = new char[pos];
do {
    tmp[--pos] = list.charAt(--value % list.length());
    value /= list.length();
...
voidtoChars(byte b, char[] result, int position)
to Chars
result[position + 1] = DIGITS[b & 0xF]; 
result[position] = DIGITS[(b >> 4) & 0xF]; 
inttoChars(final int cp, final char[] buffer, final int offset)
Converts the given codepoint into the given character array.
if (cp < 0x10000) {
    if (offset >= buffer.length) {
        return -1;
    if (cp < 0) {
        buffer[offset] = 0xffff;
    } else if (cp >= 0xdc00 && cp < 0xE000) {
        buffer[offset] = 0xffff;
...
inttoChars(int codePoint, char[] dst, int dstIndex)
Converts the specified character (Unicode code point) to its UTF-16 representation.
if (codePoint < 0 || codePoint > MAX_CODE_POINT) {
    throw new IllegalArgumentException();
if (codePoint < MIN_SUPPLEMENTARY_CODE_POINT) {
    dst[dstIndex] = (char) codePoint;
    return 1;
toSurrogates(codePoint, dst, dstIndex);
...
inttoChars(int number, char chars[])
to Chars
if (number == Integer.MIN_VALUE) {
    System.arraycopy(min_value, 0, chars, 0, min_value.length);
    return min_value.length;
int size = (number < 0) ? stringSize(-number) + 1 : stringSize(number);
getChars(number, size, chars);
return size;