public static String bytesToString ( final byte [ ] arr , final boolean signed , final boolean littleEndian , final String sep ) { final StringBuilder sb = new StringBuilder ( ) ; final int mask = ( signed ) ? 0XFFFFFFFF : 0XFF ; final int arrLen = arr . length ; if ( littleEndian ) { for ( int i = 0 ; i < ( arrLen - 1 ) ; i ++ ) { sb . append ( arr [ i ] & mask ) . append ( sep ) ; } sb . append ( arr [ arrLen - 1 ] & mask ) ; } else { for ( int i = arrLen ; i -- > 1 ; ) { sb . append ( arr [ i ] & mask ) . append ( sep ) ; } sb . append ( arr [ 0 ] & mask ) ; } return sb . toString ( ) ; }
Returns a string view of a byte array