ByteBuffer byteBuffer = ByteBuffer.allocate(BUFFERSIZE);
boolean isConnect = true;
try {
  int nbytes = channel.read(byteBuffer);
  if (nbytes == -1) {
                      isConnect = false;
  }
 } catch (IOException e) {
isConnect = false;
 }
if (!isConnect) {
  channel.close();
  msgBufs = new StringBuffer("");
  return;
}
byteBuffer.flip(); String str = bytesToHexStr(byteBuffer.array());
System.out.println(str);  //输出十六进制
byte[] b = str.getBytes("UnicodeBigUned");
System.out.println(new String(b, "GBK"));  //乱码
            高手解决下,急