Sample
MBJP/11
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 18.8Δ 37.5 |
| Scalabrino | 0.544 | 0–1; higher is more readable | 25.0Δ 31.2 |
| Dorn | 0.487 | 0–1; higher is more readable | 18.8Δ 37.5 |
| Mi | 0.522 | 0–1; higher is more readable | 31.2Δ 25.0 |
| LLOC | 14 | Logical lines; fewer is more readable | 28.1Δ 28.1 |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs | 65.6Δ 9.4 |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs | 65.6Δ 9.4 |
| BTTF | 0.574 | 0–1; higher is more readable | 62.5Δ 6.2 |
| Human | 4 | 1–5; original rating | 56.2 |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones. | 1020.379 | −33.672 |
| Source linesThe number of non-empty source lines. | 36 | +14.4 |
| Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value. | 4.417 | −6.626 |
Intercept 8.87 + feature contributions = -17.028 (log-odds).
Score = sigmoid(-17.028) = 0.
| Score | 0.544 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 104 | +0.874 |
| Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names. | 103.944 | −0.737 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 36 | −0.238 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 26 | −0.176 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 26 | +0.162 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.106 | −0.084 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 34.838 | +0.077 |
Intercept 0.07 + feature contributions = -0.053 (log-odds).
Score = sigmoid(-0.053) = 0.487.
| Score | 0.522 |
|---|
| Score | 14 |
|---|
Run 1
The code is generally clean and easy to follow. It has a clear structure with a single method, minimal nesting, and good readability. Each action is placed on its own line, and the logic flows naturally from validation to finding indices, then to string construction. The method name and comments clarify intent. There is mild redundancy in imports (java.lang, java.math, java.io) and the null/empty check could be simplified, but overall the code is concise and maintainable.
Run 2
The code is exceptionally readable. It has a clear structure with input validation, edge-case handling, and a straightforward loop. Nesting is minimal—only a single if statement inside the loop. Intent is obvious from the method and variable names, and the docstring clearly explains the purpose with examples. Action granularity is appropriate: each line performs one logical step. The only minor weaknesses are the unused imports (java.io, java.lang, java.math) and a slightly redundant edge-case comment, but these are trivial. The loop is simple and efficient, though a two-pass approach using StringBuilder.deleteCharAt could be marginally shorter. Overall, it follows clean-code principles well.
Run 3
The code is well-structured and readable. It follows logical organization with clear method separation. Nesting is minimal, with only one level of conditional and loop nesting. Intent is clear through good variable naming and a helpful Javadoc comment with examples. Code length is appropriate, and actions are granular, generally one per line. The reading flow is natural; validation occurs upfront, followed by index computation, edge case handling, and then string construction. Minor improvement could be extracting the character-not-found condition into a separate guard clause, but overall the code is concise, maintainable, and easy to understand.
Run 1
Code Structure: Logically organized into input validation, occurrence lookup, filtering, and return. Nesting: Shallow, with guard clauses and only one conditional inside the loop. Clarity of intent: Descriptive index names and documented examples make the purpose clear; however, leaving a single occurrence unchanged may be surprising given the stated goal. Code length: Concise implementation, though unused wildcard imports add clutter. Action granularity: Each statement performs one clear action, and formatting is consistent. Reading flow: Natural top-to-bottom progression makes the algorithm easy to follow.
Run 2
Code Structure: Logically organized into input validation, occurrence lookup, and result construction. Nesting: Shallow, with guard clauses limiting complexity and only one conditional inside the loop. Clarity of intent: Descriptive index names, examples, and a comment explain the behavior, although abbreviated names such as RemoveOcc, s, and ch reduce clarity slightly; leaving a single occurrence unchanged may also surprise readers. Code length: Concise overall, but unused wildcard imports add clutter. Action granularity: Each statement performs one clear action. Reading flow: Natural progression from validation to processing to return, with consistent formatting.
Run 3
Code Structure: Logically organized into validation, occurrence lookup, and result construction. Nesting: Early returns keep nesting shallow; only a single conditional sits inside the loop. Clarity of intent: Descriptive names such as target, firstIndex, lastIndex, and result make the algorithm clear, and examples document its purpose. However, leaving a single occurrence unchanged may be surprising given the stated goal. Code length: The implementation is concise, though unused wildcard imports and the redundant java.lang import add clutter. Action granularity: Each statement performs one clear action, with conventional loop syntax. Reading flow: Execution proceeds naturally from input checks to locating matches and building the output; spacing and the explanatory comment support readability.