1 18 19 package sync4j.framework.tools; 20 21 24 public class DbgTools { 25 26 public static String bytesToHex (byte [] b) { 27 StringBuffer buf = new StringBuffer (""); 28 for (int i=0; i< b.length;i++) 29 buf.append (byteToHex (b[i])); 30 return buf.toString (); 31 } 32 33 public static String byteToHex (byte b) { 34 char hexDigit[] = { 36 '0', '1', '2', '3', '4', '5', '6', '7', 37 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' 38 }; 39 char[] array = { hexDigit[(b >> 4) & 0x0f], hexDigit[b & 0x0f] }; 40 return new String (array); 41 } 42 43 } | Popular Tags |