Java Utililty Methods Char Array Create

List of utility methods to do Char Array Create

Description

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

Method

char[]toCharArray(String s)
to Char Array
if (!charArrayBugTested) {
    charArrayBugTested = true;
    if (s.toCharArray() == s.toCharArray()) {
        charArrayBug = true;
if (charArrayBug) {
    char[] c = new char[s.length()];
...
char[]toCharArray(String str)
Safe-get for null Strings to char array conversion.
if (str == null) {
    return null;
return str.toCharArray();
char[]toCharArray(String str)
to Char Array
char[] result = str.toCharArray();
return result;
char[]toCharArray(String str)
Get the character array for a string.
return str == null ? new char[0] : str.toCharArray();
char[]toCharArray(String string)
to Char Array
char[] result = new char[string.length()];
for (int i = 0; i < result.length; i++) {
    result[i] = string.charAt(i);
return result;
char[]toCharArray(String[] v)
to Char Array
char[] result = new char[v.length];
for (int i = 0; i < v.length; ++i) {
    if (v[i].length() != 1)
        throw new Exception("Invalid char value #" + i + " coming in as " + v[i] + ".");
    result[i] = v[i].charAt(0);
return result;
char[]toCharArray(StringBuffer stringbuffer)
to Char Array
return toCharArray(stringbuffer, 0, stringbuffer.length());
char[][]toCharArrays(String[] a)
Converts a String[] to char[][].
int len = a.length;
char[][] result = new char[len][];
for (int i = 0; i < len; ++i) {
    result[i] = toChars(a[i]);
return result;
Class[]toClassArray(final Object[] args)
to Class Array
final Class<?>[] classes = new Class<?>[args.length];
for (int i = 0; i < args.length; i++) {
    classes[i] = args[i].getClass();
return classes;
Class[]toClassArray(Object[] params)
to Class Array
if (null == params) {
    return new Class[0];
Class[] classParams = new Class[params.length];
for (int i = 0; i < params.length; i++) {
    classParams[i] = params[i].getClass();
return classParams;
...