title: How to decompress a string such as "a3b3" to aaabbb?
body: <p>I'm trying to take user input like <code>a3b3</code> and decompress it to <code>aaabbb</code>. This is the code I came up with, and it prints <code>a33b</code>. </p>
  
  <pre><code>String getDecompressedText() {
      int i;
      int n = 1;
      String d = "";
      for (i = 0; i &lt; compressedText.length(); i++){
          if (Character.isDigit(compressedText.charAt(i)) == true) {
              while (n &lt; compressedText.charAt(i)-'0') {
                  d += compressedText.charAt(i);
                  n++;
              }
          }
          else
              d += compressedText.charAt(i);
      }
      return d;
  </code></pre>