How to convert byte array to hex format in Java
I know that you can use printf and also use StringBuilder.append(String.format("%x", byte)) to convert values to HEX values and display them on the console. But I want to be able to actually format the byte array so that each byte is displayed as HEX instead of decimal. Here is a section of my code that I have already that does the first two ways that I stated: if(bytes > 0) { byteArray = new byte[bytes]; // Set up array to receive these values. for(int i=0; i<bytes; i++) { byteString = hexSubString(hexString, offSet, CHARSPERBYTE, false); // Isolate digits for a single byte. Log.d("HEXSTRING"