public static String byteToHexString ( byte [ ] bytes , int start , int end ) { if ( bytes == null ) { throw new IllegalArgumentException ( "bytes == null" ) ; } StringBuilder s = new StringBuilder ( ) ; for ( int i = start ; i < end ; i ++ ) { s . append ( format ( "%02x" , bytes [ i ] ) ) ; } return s . toString ( ) ; }
Given an array of bytes it will convert the bytes to a hex string representation of the bytes