public String read(ReadBuffer buffer, int length) { char[] chars = new char[length]; for (int ii = 0; ii < length; ii++) { chars[ii] = (char) ((buffer.readByte() & 0xff) | ((buffer.readByte() & 0xff) << 8)); } return new String(chars, 0, length); }