public static String formatString ( byte [ ] b , int lineLength , String prefix , boolean addClose ) { String s = toString ( b ) ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < s . length ( ) ; i += lineLength ) { sb . append ( prefix ) ; if ( i + lineLength >= s . length ( ) ) { sb . append ( s . substring ( i ) ) ; if ( addClose ) sb . append ( " )" ) ; } else { sb . append ( s . substring ( i , i + lineLength ) ) ; sb . append ( "\n" ) ; } } return sb . toString ( ) ; }
Formats data into a nicely formatted base64 encoded String