public static String toHex ( byte [ ] data , int length ) { StringBuffer buffer = new StringBuffer ( ) ; for ( int i = 0 ; i != length ; i ++ ) { int v = data [ i ] & 0xff ; buffer . append ( DIGITS . charAt ( v >> 4 ) ) ; buffer . append ( DIGITS . charAt ( v & 0xf ) ) ; } return buffer . toString ( ) ; }
Return length many bytes of the passed in byte array as a hex string .