question: private static String byteArrayToHexString ( byte [ ] bytes ) { StringBuilder sb = new StringBuilder ( bytes . length * 2 ) ; for ( byte element : bytes ) { int v = element & 0xff ; if ( v < 16 ) { sb . append ( '0' ) ; } sb . append ( Integer . toHexString ( v ) ) ; } return sb . toString ( ) ; }
target:  Using some super basic byte array &lt;-&gt; hex conversions so we don't have to rely on any large Base64 libraries. Can be overridden if you like!