List of utility methods to do Byte Array to Unicode Convert
byte[] | ushort2bytesLE(int val, byte[] b, int off) ushortbytes LE b[off] = (byte) val; b[off + 1] = (byte) (val >>> 8); return b; |
void | convertLongVowel(byte[] b) convert Long Vowel int len = b.length; if ((len & 1) == 1) { b[len - 1] = '\0'; len--; int prevHigh = 0; int prevLow = 0; for (int i = 0; i < len; i += 2) { ... |
String | bcdToString(byte[] data, int offset, int length) Many fields in GSM SIM's are stored as nibble-swizzled BCD Assumes left-justified field that may be padded right with 0xf values. StringBuilder ret = new StringBuilder(length * 2); for (int i = offset; i < offset + length; i++) { byte b; int v; v = data[i] & 0xf; if (v > 9) break; ret.append((char) ('0' + v)); ... |
void | upperToLower(byte[] b) upper To Lower int len = b.length; if ((len & 1) == 1) { b[len - 1] = '\0'; len--; for (int i = 0; i < len; i += 2) { int high = b[i] & 0xff; int low = b[i + 1] & 0xff; ... |
void | upperToLowerLatin(byte[] b) upper To Lower Latin int len = b.length; for (int i = 0; i < len; i++) { int ch = b[i] & 0xff; if (ch == '\0') { break; } else if ((ch >= 0x41 && ch <= 0x5a) || (ch >= 0xc0 && ch <= 0xd6) || (ch >= 0xd8 && ch <= 0xde)) { ... |
byte[] | tag2bytesBE(int tag, byte[] b, int off) tagbytes BE return int2bytesBE(tag, b, off); |
byte[] | tag2bytesLE(int tag, byte[] b, int off) tagbytes LE b[off] = (byte) ((tag >>> 16) & 0xff); b[off + 1] = (byte) ((tag >>> 24) & 0xff); b[off + 2] = (byte) (tag & 0xff); b[off + 3] = (byte) ((tag >>> 8) & 0xff); return b; |
Bitmap | parseToBnW(byte[] data, int length) Convert a TS 131.102 image instance of code scheme '11' into Bitmap int valueIndex = 0; int width = data[valueIndex++] & 0xFF; int height = data[valueIndex++] & 0xFF; int numOfPixels = width * height; int[] pixels = new int[numOfPixels]; int pixelIndex = 0; int bitIndex = 7; byte currentByte = 0x00; ... |