List of utility methods to do Byte Array to Char Convert
char[] | bytetoChar(byte[] bytes) byteto Char Charset cs = Charset.forName(DEFAULT_CHARSET);
ByteBuffer bb = ByteBuffer.allocate(bytes.length);
bb.put(bytes);
bb.flip();
CharBuffer cb = cs.decode(bb);
return cb.array();
|
char | getChar(byte[] b, int index) get Char int s = 0; if (b[index + 1] > 0) s += b[index + 1]; else s += 256 + b[index + 0]; s *= 256; if (b[index + 0] > 0) s += b[index + 1]; ... |
char | getChar(byte[] bytes) get Char return (char) ((0xff & bytes[0]) | (0xff00 & (bytes[1] << 8))); |