String(byte[], int, int) 
你用这个试试,它没有deprecated

解决方案 »

  1.   

    既然hibyte是0,就用String str=new String(buffer);
      

  2.   

    String str = new String(buffer);
      

  3.   

    同上所说 
    public String(byte[] bytes)Constructs a new String by decoding the specified array of bytes using the platform's default charset. The length of the new String is a function of the charset, and hence may not be equal to the length of the byte array. 
    The behavior of this constructor when the given bytes are not valid in the default charset is unspecified. The CharsetDecoder class should be used when more control over the decoding process is required. 
    Parameters:
    bytes - the bytes to be decoded into characters