Java Byte Array to String byteTo16String(byte[] bt)

Here you can find the source of byteTo16String(byte[] bt)

Description

byte To String

License

LGPL

Declaration

public static String byteTo16String(byte[] bt) 

Method Source Code

//package com.java2s;
/**/*  w  w  w.j  ava  2 s . c om*/
 *
 * Methods Descrip:Converts a line of text into an array of lower case words
 * using a BreakIterator.wordInstance().
 * <p>
 *
 * This method is under the Jive Open Source Software License and was
 * written by Mark Imbriaco.
 *
 * @param text
 *            a String of text to convert into an array of words
 * @return text broken up into an array of words.
 *
 */

public class Main {

    public static String byteTo16String(byte[] bt) {
        String res = "";
        for (int i = 0; i < bt.length; i++) {
            int hex = (int) bt[i] & 0xff;
            System.out.print(Integer.toHexString(hex) + " ");
            res = res + Integer.toHexString(hex);
        }
        return res;
    }
}

Related

  1. bytesToString(int... bytesInt)
  2. bytesToString(long b)
  3. bytesToString(long bytes)
  4. bytesToString(long bytes)
  5. bytesToString(long size)
  6. byteToMacString(byte[] data)
  7. byteToStr(byte[] byteArray)
  8. byteToStr(byte[] byteArray)
  9. ByteToString(byte[] a, int nLen)