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

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

Description

base

License

Open Source License

Declaration

public static String base16(byte[] data) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static final int BYTE_MASK = 0xff;

    public static String base16(byte[] data) {
        return byteArray2HexString(data);
    }//from   ww w.  ja  v a  2s .  co  m

    public static String byteArray2HexString(byte[] data) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            String temp = Integer.toHexString(data[i] & BYTE_MASK);
            if (temp.length() == 1)
                temp = "0" + temp;
            sb.append(temp);
        }
        return sb.toString().toUpperCase();
    }
}

Related

  1. byteTOString(byte[] in)
  2. byteTOString(byte[] in)
  3. byteTOString(byte[] in, String encoding)
  4. byteToString(byte[] in)
  5. byteToString(int[] byteData)
  6. ByteArrayToStringList(byte[] byteArray, int dataLength)
  7. toStringForm(byte[] arr)
  8. toStringUntil(byte[] b, int pos, byte until)
  9. toStringWithLength(byte[] b, int pos, int length)