Apply capitalization of one string to another
We can do this in single traversal rather then two 

for (int i = 0; i &lt; min(apple.length(),orange.length()); i++) {
    if (Character.isUpperCase(apple.toCharArray()[i]) &amp;&amp;
        Character.isLowercase(oranger.toCharArray()[i])){
           orange[i] = Character.toUppercase(oranger.toCharArray()[i]);
    }elseif(Character.isLowerCase(apple.toCharArray()[i]) &amp;&amp; 
            Character.isUppercase(oranger.toCharArray()[i])){
           orange[i] = Character.toLowercase(oranger.toCharArray()[i]);
    }
}