public static final String hexdump ( byte [ ] buffer , int offset , int length , boolean ascii , int columns , String prefix ) { StringBuilder sb = new StringBuilder ( ) ; if ( buffer != null ) { int index = offset ; DecimalFormat df = new DecimalFormat ( "00000" ) ; while ( index < ( offset + length ) ) { if ( index + columns > ( offset + length ) ) { columns = ( offset + length ) - index ; } sb . append ( prefix ) ; sb . append ( df . format ( index - offset ) ) ; sb . append ( ":" ) ; sb . append ( hexdump ( buffer , index , columns , ascii ) ) ; sb . append ( ' ' ) ; index += columns ; } } return ( sb . toString ( ) ) ; }
Dump raw data as hex .