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

inttoChars(int[] src, int srcOff, int srcLen, char[] dest, int destOff)
Converts a sequence of unicode code points to a sequence of Java characters.
if (srcLen < 0) {
    throw new IllegalArgumentException("srcLen must be >= 0");
int written = 0;
for (int i = 0; i < srcLen; ++i) {
    written += Character.toChars(src[srcOff + i], dest, destOff + written);
return written;
...
char[]toChars(String from)
to Chars
return from.toCharArray();
char[]toChars(String s)
Converts a String to char[].
int len = s.length();
char[] chars = new char[len];
s.getChars(0, len, chars, 0);
return chars;
CharSequencetoCharSequence(final Object value)
Return the specified value as a CharSequence.
return (value instanceof CharSequence) ? (CharSequence) value : String.valueOf(value);
StringtoCharString(byte[] bytes)
to Char String
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bytes.length; i++) {
    char c = (char) (bytes[i] & 0xFF);
    sb.append(c);
    sb.append(' ');
    if (i % 8 == 7) {
        sb.append('\n');
        sb.append(' ');
...
chartoCharWithoutOverflow(double value)
Like Math#toIntExact(long) but for char range.
if (value < Character.MIN_VALUE || value > Character.MAX_VALUE) {
    throw new ArithmeticException("char overflow");
return (char) value;