public String reverseWordsInSentenceInPlace(String inputSentence) {
        logger.info("Start reverseWordsInSentenceInPlace, inputSentence = \"" + inputSentence + "\"");
        long startTime = System.nanoTime();

        StringBuilder reversedSentence = new StringBuilder(inputSentence);
        int startWord = 0;
        int endWord = -1;

        for (int i = 0; i < reversedSentence.length(); i++) {
            if (i == reversedSentence.length() - 1) {
                endWord = i;
            } else if (reversedSentence.charAt(i) == ' ') {
                endWord = i - 1;
            }

            // when a word has been found, reverse it and reset startWord and endWord
            if (endWord != -1) {
                reversePartOfStringBuilder(reversedSentence, startWord, endWord);
                startWord = endWord + 2;
                endWord = -1;
            }
        }

        // At this point the words are reversed in place; now reverse the entire
        // StringBuilder that has the words in reverse order
        reversePartOfStringBuilder(reversedSentence, 0, reversedSentence.length() - 1);

        long endTime = System.nanoTime();
        long duration = endTime - startTime;
        String outputSentence = reversedSentence.toString();
        logger.info("End reverseWordsInSentenceInPlace, outputSentence = \"" + outputSentence + "\"");
        logger.info("Time to run: " + duration + "\n");
        return outputSentence;
    }