Print a String's even and odd indexes I implemented this method and wanted to get suggestions and or improvements.
The objective of the method is to print the even and odd indexes of Strings contained within an array. Each set of indexes(even and odd) should be seperated by a space.

public static void printEvenOddIndexes(String[] strings){

    for(int i = 0; i &lt; strings.length;i++){
        String word = strings[i];
        ArrayList&lt;Integer&gt; oddIndexes  = new ArrayList&lt;&gt;();
        for(int j= 0; j &lt; word.length();j++){
            if(j % 2 == 0){
                System.out.print(word.charAt(j));
            }else{
                oddIndexes.add(j);
            }
        }
        System.out.print(" ");
        for(Integer index : oddIndexes){
            System.out.print(word.charAt(index));
        }
        System.out.println();
    }
 }
Printing the characters at the even and odd indexes sounds like two similar tasks. So the code for these tasks should look very similar. You can either extract that code to a separate method, or, since it is very simple, just write the code twice.

public static void printEvenOddIndexes(String[] strings) {          
    for (String word : strings) {

        for (int i = 0; i &lt; word.length(); i += 2) {
            System.out.print(word.charAt(i));
        }

        System.out.print(" ");

        for (int i = 1; i &lt; word.length(); i += 2) {
            System.out.print(word.charAt(i));
        }

        System.out.println();
    }
 }


The two loops only differ by the starting index. Note the += 2 at the end of the for loop.