byte[] data to String

December 28, 2012   ·   0 Comments


    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();

    }

    

shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Android7

Amazon

adsbygoogle

Recent Posts

Categories

Amazon