Java examples for java.lang:byte Array to String
byte array to String
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { byte[] theByteArray = new byte[] { 34, 35, 36, 37, 37, 37, 67, 68, 69 };/* w w w . j a v a 2 s .c o m*/ System.out.println(toString(theByteArray)); } 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'); } out.append(s).append(' '); } return out.toString(); } }