protected static String byteArrayToString ( byte [ ] array , boolean quote ) { StringBuffer sb = new StringBuffer ( ) ; if ( quote ) sb . append ( ' ' ) ; for ( int i = 0 ; i < array . length ; i ++ ) { int b = array [ i ] & 0xFF ; if ( b < 0x20 || b >= 0x7f ) { sb . append ( ' ' ) ; sb . append ( byteFormat . format ( b ) ) ; } else if ( b == ' ' || b == ' ' ) { sb . append ( ' ' ) ; sb . append ( ( char ) b ) ; } else sb . append ( ( char ) b ) ; } if ( quote ) sb . append ( ' ' ) ; return sb . toString ( ) ; }
Converts a byte array into a String .