public BinaryString reverse ( ) { ensureMaterialized ( ) ; if ( inFirstSegment ( ) ) { byte [ ] result = new byte [ this . sizeInBytes ] ; // position in byte int byteIdx = 0 ; while ( byteIdx < sizeInBytes ) { int charBytes = numBytesForFirstByte ( getByteOneSegment ( byteIdx ) ) ; segments [ 0 ] . get ( offset + byteIdx , result , result . length - byteIdx - charBytes , charBytes ) ; byteIdx += charBytes ; } return BinaryString . fromBytes ( result ) ; } else { return reverseSlow ( ) ; } }
Reverse each character in current string .