Ad
  • Custom User Avatar

    Compiler won't do StringBuilder magic on this one most likely. In general that loop gets turned into:

    String result = "";
    for (int i = 0; i < str.length()-4; i++) {
    result = new StringBuilder().append(result).append('#').toString();
    }

  • Default User Avatar

    That's a ton of String objects created and thrown away (or hope for the compilers StringBuilder replacement magic)