错误提醒很明显:&符号不能用于 字节数组与int之间。for循环中那句:strBuffer.append(Integer.toHexString(b & 0xff));改成strBuffer.append(Integer.toHexString(b[i] & 0xff));试试。