String (@NotNull CommonCodeStyleSettings.IndentOptions indentOptions, int indent) { int indentLevel = (indent + INDENT_FACTOR / 2) / INDENT_FACTOR; int spaceCount = indent - indentLevel * INDENT_FACTOR; int indentLevelSize = indentLevel * indentOptions.INDENT_SIZE; int totalSize = indentLevelSize + spaceCount; StringBuilder buffer = new StringBuilder(); if (indentOptions.USE_TAB_CHARACTER) { if (indentOptions.SMART_TABS) { int tabCount = indentLevelSize / indentOptions.TAB_SIZE; int leftSpaces = indentLevelSize - tabCount * indentOptions.TAB_SIZE; for (int i = 0; i < tabCount; i++) { buffer.append('\t'); } for (int i = 0; i < leftSpaces + spaceCount; i++) { buffer.append(' '); } } else { int size = totalSize; while (size > 0) { if (size >= indentOptions.TAB_SIZE) { buffer.append('\t'); size -= indentOptions.TAB_SIZE; } else { buffer.append(' '); size--; } } } } else { for (int i = 0; i < totalSize; i++) { buffer.append(' '); } } return buffer.toString(); }