code: private static String muliplier(String formula, int factor) {
          String finalformula = "";
          String recentElementSymbol = "";
          String recentElementCountString = "0";
          for (int f = 0; f < formula.length(); f++) {
              char thisChar = formula.charAt(f);
              if (f < formula.length()) {
                  if (thisChar >= 'A' && thisChar <= 'Z') {
                      recentElementSymbol = String.valueOf(thisChar);
                      recentElementCountString = "0";
                  }
                  if (thisChar >= 'a' && thisChar <= 'z') {
                      recentElementSymbol += thisChar;
                  }
                  if (thisChar >= '0' && thisChar <= '9') {
                      recentElementCountString += thisChar;
                  }
              }
              if (f == formula.length() - 1 || (formula.charAt(f + 1) >= 'A' && formula.charAt(f + 1) <= 'Z')) {
                  Integer recentElementCount = Integer.valueOf(recentElementCountString);
                  if (recentElementCount == 0)
                      finalformula += recentElementSymbol + factor;
                  else
                      finalformula += recentElementSymbol + recentElementCount * factor;
              }
          }
          return finalformula;
      }
docs: This method multiply all the element over a value.
  
  @param formula Formula to correct
  @param factor  Factor to multiply
  @return        Formula with the correction