private static String convertByteArrayToClearText ( byte [ ] bytes ) { StringBuffer result = new StringBuffer ( ) ; for ( int i = 0 ; i < bytes . length ; i += 2 ) { char thisChar = ( char ) ( bytes [ i ] << 8 | bytes [ i + 1 ] ) ; result . append ( thisChar ) ; } return result . toString ( ) ; }
Convert a byte array to text by joining each two bytes into a 16 - bit character .