Java Utililty Methods ASCII from

List of utility methods to do ASCII from

Description

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

Method

byte[]toASCIICode(byte[] bts)
to ASCII Code
byte[] format_str = new byte[128];
int btsLength = bts.length;
int year = btsLength > 1 ? bts[0] * 256 + 256 + bts[1] : 1900;
int month = btsLength > 2 ? bts[2] : 1;
int day = btsLength > 3 ? bts[3] : 1;
int hour = btsLength > 4 ? bts[4] : 0;
int minute = btsLength > 5 ? bts[5] : 0;
int second = btsLength > 6 ? bts[6] : 0;
...
StringtoAsciiFilename(String string)
to Ascii Filename
return string.replaceAll("[^0-9a-zA-Z-.]", "_");
chartoAsciiLowerCase(char ch)
Converts the specified character to lower case if it is a valid latin letter, otherwise the same character is returned.
if ((ch >= 'A') && (ch <= 'Z')) {
    return (char) (ch + 'a' - 'A');
} else {
    return ch;
StringtoAsciiString(byte[] buffer)
Returns the bytes as an ASCII String.
return toAsciiString(buffer, 0, buffer.length);
StringtoAsciiString(byte[] buffer, int startPos, int length)
to Ascii String
char[] charArray = new char[length];
int readpoint = startPos;
for (int i = 0; i < length; i++) {
    charArray[i] = (char) buffer[readpoint];
    readpoint++;
return new String(charArray);
StringtoAsciiString(byte[] bytes)
to Ascii String
for (int i = 0; i < bytes.length; i++) {
    if (bytes[i] < 0)
        return null;
char[] chars = new char[bytes.length];
for (int i = 0; i < bytes.length; i++) {
    chars[i] = (char) bytes[i];
return new String(chars);
StringtoASCIIString(byte[] data)
Produces a string using each byte as an ASCII character
if (data == null) {
    return null;
String s = "";
for (int i = 0; i < data.length; i++) {
    char b = (char) data[i];
    s = s + b;
return s;
StringtoAsciiString(byte[] output)
to Ascii String
char[] chars = new char[output.length];
for (int i = 0; i < output.length; i++) {
    chars[i] = (char) output[i];
return new String(chars);
StringtoAsciiString(String s)
to Ascii String
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
    char c = s.charAt(i);
    if (c > 127) {
        sb.append(toUnicodeStr(c));
    } else {
        sb.append((char) c);
return sb.toString();
StringtoAsciiString(String value)
to Ascii String
int i, j;
int len = value.length();
if ((len % 2) != 0) {
    return value;
try {
    byte[] byteValue = new byte[len / 2];
    j = 0;
...