List of utility methods to do String to Octal
String | convertStringToOctal(String literalString) Convert a utf-8 encoded string into into an octal enocded byte[] array. int length = literalString.length(); boolean foundExtendedAscii = false; for (int i = 0; i < length; i++) { if (literalString.charAt(i) >= 255) { foundExtendedAscii = true; break; if (foundExtendedAscii) { char[] octalEncoded = new char[length * 2 + 2]; octalEncoded[0] = 254; octalEncoded[1] = 255; for (int i = 0, j = 2; i < length; i++, j += 2) { octalEncoded[j] = (char) ((literalString.charAt(i) >> 8) & 0xFF); octalEncoded[j + 1] = (char) (literalString.charAt(i) & 0xFF); return new String(octalEncoded); } else { return literalString; |