byte[] data to String



    private String convert(byte[] data) {

        StringBuilder sb = new StringBuilder(data.length);

        for (int i = 0; i < data.length; ++ i) {

            if (data[i] < 0 &&  data[i] < 32 )

            {

            // throw new IllegalArgumentException();

            }else{

              sb.append((char) data[i]);

            }

        }

        return sb.toString();

    }

    


Leave a Reply