code: public static String tabsToSpaces(String in, int tabSize) {
          StringBuilder buf = new StringBuilder();
          int width = 0;
          for (int i = 0; i < in.length(); i++) {
              switch (in.charAt(i)) {
                  case '\t':
                      int count = tabSize - (width % tabSize);
                      width += count;
                      while (--count >= 0) {
                          buf.append(' ');
                      }
                      break;
                  case '\n':
                      width = 0;
                      buf.append(in.charAt(i));
                      break;
                  default:
                      width++;
                      buf.append(in.charAt(i));
                      break;
              }
          }
          return buf.toString();
      }
docs: Converts tabs to consecutive spaces in the specified string.
  
  @param in The string
  @param tabSize The tab size