private static String getDecodedStr ( byte [ ] decBytes ) { // prepare StringBuilder with capacity being the smallest power of 2 // greater than decBytes.length*6 int n = decBytes . length * 6 ; int capacity = leastPowerOf2GreaterThanOrEqualTo ( n ) ; StringBuilder decStr = new StringBuilder ( capacity ) ; for ( int i = 0 ; i < decBytes . length ; i ++ ) { int decByte = decBytes [ i ] ; String bitStr = Integer . toBinaryString ( decByte ) ; int padding = Math . max ( 0 , 6 - bitStr . length ( ) ) ; for ( int j = 0 ; j < padding ; j ++ ) { decStr . append ( ' ' ) ; } for ( int j = 0 ; j < 6 - padding ; j ++ ) { decStr . append ( bitStr . charAt ( j ) ) ; } } return decStr . toString ( ) ; }
Get decoded string from bytes .