Android Byte Array to String Convert byteArrayToString(byte[] data)

Here you can find the source of byteArrayToString(byte[] data)

Description

Returns a (readable) String representation of the byte array

License

Open Source License

Parameter

Parameter Description
data complete data array [header+body]

Return

bytes as a String

Declaration

static String byteArrayToString(byte[] data) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*ww  w.  java  2  s .  c  o  m*/
     * Returns a (readable) String representation of the byte array
     * 
     * @param data
     *            complete data array [header+body]
     * @return bytes as a String
     */
    static String byteArrayToString(byte[] data) {
        StringBuilder sb = new StringBuilder();
        for (byte b : data) {

            sb.append(Integer.toString(b));
        }
        return sb.toString();
    }
}

Related

  1. bytesToByteString(byte[] bytes)
  2. toText(byte[] arr)
  3. byteArray(StringBuilder buffer, byte[] bytes)
  4. byteArrayToInt(byte[] value, int offset)
  5. byteArrayToShort(byte[] value, int offset)
  6. byteArrayToString(byte[] data)
  7. writeByteArray(byte[] bytes)