Java Utililty Methods ASCII to String

List of utility methods to do ASCII to String

Description

The list of methods to do ASCII to String are organized into topic(s).

Method

Stringascii2Str(String s)
ascii Str
String[] chars = s.split(" ");
StringBuffer result = new StringBuffer();
for (int i = 0; i < chars.length; i++) {
    result.append((char) Integer.parseInt(chars[i]));
return result.toString();
Stringascii2String(String ASCIIs)
ascii String
String[] ASCIIss = ASCIIs.split(",");
StringBuffer sb = new StringBuffer();
for (int i = 0; i < ASCIIss.length; i++) {
    sb.append((char) ascii2Char(Integer.parseInt(ASCIIss[i])));
return sb.toString();
char[]asciiBytesToChar(byte[] bytes)
Converts bytes from ascii encoded text to a char[] and zero outs the original byte[]
char[] chars = new char[bytes.length];
for (int i = 0; i < bytes.length; i++) {
    chars[i] = (char) bytes[i];
    bytes[i] = '\0';
return chars;
StringasciiBytesToString(byte[] val)
Convert a byte array to a String assuming the ASCII character set, for use in cases (such as early in the boot process) where character set conversion is unavailable or inadvisable.
return asciiBytesToString(val, 0, val.length);
charASCIIToChar(final int ascii)
Convert the ASCII value to character
return (char) ascii;
StringAsciiToChar(int asc)
Ascii To Char
String TempStr = "A";
char tempchar = (char) asc;
TempStr = String.valueOf(tempchar);
return TempStr;
StringasciiToLowerCase(String s)
ascii To Lower Case
char[] c = s.toCharArray();
int i = s.length();
while (i-- > 0) {
    char c1 = c[i];
    if (c1 <= 127) {
        char c2 = lowercases[c1];
        if (c1 != c2) {
            c[i] = c2;
...
StringasciiToString(byte ascii)
ascii To String
switch (ascii) {
case (int) '\n':
    return "\\n";
case (int) '\t':
    return "\\t";
case 11:
    return "\\v";
case 7:
...
StringasciiToString(byte[] b, int off, int len)
ascii To String
char[] c = new char[len];
for (int i = 0; i < len; ++i) {
    c[i] = (char) (b[off + i] & 0xff);
return new String(c);
StringasciiToString(int asciiCode)
ascii To String
return String.valueOf((char) asciiCode);