java中utf-8编码的byte数组转换成String类型代码

private String utfToString(byte[] data) {

    String str = null;

    try {
           str = new String(data, "utf-8");
    } catch (UnsupportedEncodingException e) {
    }   

    return str;

 }

你可能感兴趣的:(java,String,null,byte)