import java.util.ArrayList;
import java.util.List;

class Atbash {

    private static final int GROUP_SIZE = 5;
    private static final String PLAIN = "abcdefghijklmnopqrstuvwxyz";
    private static final String CIPHER = "zyxwvutsrqponmlkjihgfedcba";

    String encode(String input) {
        String encoded = stripInvalidCharacters(input).toLowerCase();
        String cyphered = "";

        for (char c : encoded.toCharArray()) {
            cyphered += applyCipher(c);
        }

        return splitIntoFiveLetterWords(cyphered);
    }

    String decode(String input) {
        String encoded = stripInvalidCharacters(input).toLowerCase();
        String deciphered = "";

        for (char c : encoded.toCharArray()) {
            deciphered += applyCipher(c);
        }

        return deciphered;
    }

    String stripInvalidCharacters(String input) {
        String filteredValue = "";

        for (char c : input.toCharArray()) {
            if (Character.isLetterOrDigit(c)) {
                filteredValue += c;
            }
        }

        return filteredValue;
    }

    private char applyCipher(char input) {
        int idx = PLAIN.indexOf(input);

        return idx >= 0 ? CIPHER.toCharArray()[idx] : input;
    }

    private String splitIntoFiveLetterWords(String value) {
        List<String> words = new ArrayList<>();

        for (int i = 0; i < value.length(); i += GROUP_SIZE) {
            words.add(i + GROUP_SIZE <= value.length() ? value.substring(i, i + GROUP_SIZE) : value.substring(i));
        }

        return String.join(" ", words);
    }
}

@@ -366,16 +366,23 @@
   String
+Builder
  cyphere
@@ -377,34 +377,65 @@
 lder cyphered = 
-%22%22
+new StringBuilder(input.length())
 ;%0A%0A        for (
@@ -484,28 +484,32 @@
     cyphered
- += 
+.append(
 applyCipher(
@@ -502,32 +502,33 @@
 d(applyCipher(c)
+)
 ;%0A        %7D%0A%0A   
@@ -572,16 +572,27 @@
 cyphered
+.toString()
 );%0A    %7D
@@ -707,24 +707,31 @@
       String
+Builder
  deciphered 
@@ -732,18 +732,49 @@
 hered = 
-%22%22
+new StringBuilder(input.length())
 ;%0A%0A     
@@ -837,20 +837,24 @@
 ciphered
- += 
+.append(
 applyCip
@@ -859,16 +859,17 @@
 ipher(c)
+)
 ;%0A      
@@ -898,16 +898,27 @@
 ciphered
+.toString()
 ;%0A    %7D%0A
@@ -982,16 +982,23 @@
   String
+Builder
  filtere
@@ -1010,10 +1010,41 @@
 e = 
-%22%22
+new StringBuilder(input.length())
 ;%0A%0A 
@@ -1168,13 +1168,18 @@
 alue
- += c
+.append(c)
 ;%0A  
@@ -1229,16 +1229,27 @@
 redValue
+.toString()
 ;%0A    %7D%0A

Use StringBuilder in methods