I have a byte array filled with hex numbers and printing it the easy way is pretty pointless because there are many unprintable elements. What I need is the exact hexcode in
The Apache Commons Codec library has a Hex class for doing just this type of work.
import org.apache.commons.codec.binary.Hex; String foo = "I am a string"; byte[] bytes = foo.getBytes(); System.out.println( Hex.encodeHexString( bytes ) );