code: private static void replaceWords(StringBuilder input, String[] words, String[] replaces, boolean ignoreCase) {
          if (input == null || input.length()==0 || words == null ||
                  words.length == 0 || replaces == null || replaces.length == 0) {
              return;
          }
  
          // the same number of word to replace and replaces to use
          if (words.length != replaces.length) {
              throw new IllegalArgumentException(String.format("Words (%d) and replaces (%d) lengths should be equals", words.length, replaces.length));
          }
  
          for(int i = 0; i < words.length; i++) {
              replaceWord(input, words[i], replaces[i], ignoreCase);
          }
      }
docs: To avoid repeat this code above