Reverse chars of each word in a string An algorithm to reverse characters of each word in a sentence.
What would be your concerns regarding the following solution?

Example input: "I love New York"
output: "I evol weN kroY"

public class Main {
    public static void main(String[] args) throws IOException {
        final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        final BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(System.out));

        final String words = bufferedReader.readLine().trim();
        final char[] reversedWord = reverseWords(words.toCharArray());

        bufferedWriter.write(reversedWord);

        bufferedReader.close();
        bufferedWriter.close();
    }

    private static char[] reverseWords(char[] input) {
        int startIndex = 0;
        int endIndex = 0;
        while (endIndex &lt; input.length) {
            final boolean isLastWord = endIndex == input.length - 1;
            if (input[endIndex] == ' ' || isLastWord) {
                if (isLastWord) {
                    endIndex++;
                }
                reverseWord(input, startIndex, endIndex);
                startIndex = ++endIndex;
            } else {
                endIndex++;
            }
        }
        return input;
    }

    private static void reverseWord(char[] word, int startIndex, int endIndexExclusive) {
        final int wordLength = (endIndexExclusive - startIndex);
        for (int i = 0; i &lt; wordLength/2; i++) {
            final char temp = word[startIndex + i];
            word[startIndex + i] = word[endIndexExclusive - i - 1];
            word[endIndexExclusive - i - 1] = temp;
        }
    }
}


Unit tests would be like:

public class QuestionOneTest {
    @Test
    public static should_reverse_chars() {
        // given
        final String input = "I love New York";

        // when
        final char[] reversed = QuestionOne.reverseWords(input.toCharArray());

        // then
        assert String.copyValueOf(reversed).equals("I evol weN kroY");
    }
}
If you don't want to reinvent the wheel, you can implement a very short and simple solution using java.util:

public class Main {
    public static void main(final String[] args) throws IOException {
        final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        final BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(System.out));

        final String line = bufferedReader.readLine().trim();
        List&lt;String&gt; words = Arrays.asList(line.split("\\s+"));

        String reversedWords = reverseWords(words);

        bufferedWriter.write(reversedWords.toCharArray());

        bufferedReader.close();
        bufferedWriter.close();
    }

    private static String reverseWords(final List&lt;String&gt; words) {
        return words.stream().map(word -&gt; reverseWord(word)).collect(Collectors.joining(" "));
    }

    private static String reverseWord(final String word) {
        return new StringBuilder(word).reverse().toString();
    }
}