List of utility methods to do ASCII
String | asciiString(byte[] bytes, int from, int count) ascii String char value[] = new char[count]; for (int i = 0; i < count; ++i) value[i] = (char) (bytes[i + from] & 0xff); return new String(value); |
byte[] | asciiString(String fourcc) ascii String char[] ch = fourcc.toCharArray(); byte[] result = new byte[ch.length]; for (int i = 0; i < ch.length; i++) { result[i] = (byte) ch[i]; return result; |
String | AsciiStringToString(String content) Ascii String To String String result = ""; int length = content.length() / 2; for (int i = 0; i < length; i++) { String c = content.substring(i * 2, i * 2 + 2); int a = hexStringToAlgorism(c); char b = (char) a; String d = String.valueOf(b); result += d; ... |
byte[] | asciiToBCD(byte[] ascii, int asc_len) ascii To BCD byte[] bcd = new byte[asc_len / 2]; int j = 0; for (int i = 0; i < (asc_len + 1) / 2; i++) { bcd[i] = asc_to_bcd(ascii[j++]); bcd[i] = (byte) (((j >= asc_len) ? 0x00 : asc_to_bcd(ascii[j++])) + (bcd[i] << 4)); return bcd; |
byte[] | asciiToEbcdic(String s) ascii To Ebcdic return asciiToEbcdic(s.getBytes());
|
int | ASCIIToInteger(String ascii) ASCII To Integer long number = (ascii.charAt(0) - 97 << 28) | ((ascii.charAt(1) - 97) << 24) | ((ascii.charAt(2) - 97) << 20) | ((ascii.charAt(3) - 97) << 16) | ((ascii.charAt(4) - 97) << 12) | ((ascii.charAt(5) - 97) << 8) | ((ascii.charAt(6) - 97) << 4) | ((ascii.charAt(7) - 97)); return (int) number; |
int | asciiValue(byte b) ascii Value if ((b >= '0') && (b <= '9')) { return (b - '0'); if ((b >= 'a') && (b <= 'f')) { return (b - 'a') + 0x0a; if ((b >= 'A') && (b <= 'F')) { return (b - 'A') + 0x0a; ... |