Android Byte Array to String Convert toString(byte[] theByteArray)

Here you can find the source of toString(byte[] theByteArray)

Description

to String

License

LGPL

Declaration

public static String toString(byte[] theByteArray) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static String toString(byte[] theByteArray) {
        StringBuffer out = new StringBuffer();
        for (int i = 0; i < theByteArray.length; i++) {
            String s = Integer.toHexString(theByteArray[i] & 0xff);
            if (s.length() < 2) {
                out.append('0');
            }//  ww w.j  ava 2 s.  c  om
            out.append(s).append(' ');
        }
        return out.toString();
    }
}

Related

  1. toAsciiString(byte[] raw)
  2. toString(byte[] array)
  3. toString(byte[] array, String separator, int frequency)
  4. toString(byte[] b)
  5. fromBytes(byte[] buf)
  6. fromBytes(byte[] buf, int off, int len)
  7. bytes2String(byte[] value)
  8. byte2String(byte[] is)