private static void invertBuffer(char[] buffer,
                                     int start,
                                     int length) {

        for(int i = start, j = start + length - 1; i < j; i++, --j) {
            char temp = buffer[i];
            buffer[i] = buffer[j];
            buffer[j] = temp;
        }
    }
private static void invertBuffer ( char [ ] buffer , int start , int length ) { for ( int i = start , j = start + length - 1 ; i < j ; i ++ , -- j ) { char temp = buffer [ i ] ; buffer [ i ] = buffer [ j ] ; buffer [ j ] = temp ; } }
/*
Name    : invertBuffer
Function: This function inverts the buffer, it's used
in case the user specifies the buffer to be
TEXT_DIRECTION_LOGICAL