Sample
int-109590781a81-I13
Lower every eligible classic and enhanced for loop to a while loop
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Scalabrino | 0.854 | 0–1; higher is more readable |
| Dorn | 0.497 | 0–1; higher is more readable |
| Mi | 0.584 | 0–1; higher is more readable |
| LLOC | 23 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18.33 | 0–20; mean of three runs |
| BTTF | 0.448 | 0–1; higher is more readable |
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. | 1795.802 | −59.261 |
| Source linesThe number of non-empty source lines. | 53 | +21.2 |
| 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.895 | −7.343 |
Intercept 8.87 + feature contributions = -36.534 (log-odds).
Score = sigmoid(-36.534) = 0.
| Score | 0.854 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 54 | −0.876 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 97.981 | +0.776 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 43 | +0.75 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 43 | −0.566 |
| 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. | 97.981 | −0.485 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 52.848 | +0.329 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.098 | −0.012 |
Intercept 0.07 + feature contributions = -0.013 (log-odds).
Score = sigmoid(-0.013) = 0.497.
| Score | 0.584 |
|---|
| Score | 23 |
|---|
Run 1
The code is highly readable. It has a clear, logical structure: a private constructor, constants, and a single public method. The method's Javadoc clearly explains the intent and edge cases. Nesting is shallow (only two levels), and action granularity is one action per line within the if-else chain. The chain of primitive type checks is explicit and follows a natural order, though it is somewhat verbose; a switch statement or map could reduce length, but the current form prioritizes clarity. The only minor drawbacks are the unchecked casts and the suppressions, which slightly obscure the type-safety rationale. Overall, the code is straightforward, self-documenting, and easy to follow.
Run 2
The code is highly readable. It has clear structure: a private constructor, documented constants, and a single well-named public method. The method checks for null, then uses a straightforward if-else chain for primitives, returning null for non-primitives and void. Nesting is shallow (two levels). Intent is explicit—mapping each primitive to its JLS default. The method is concise but could be slightly improved by replacing the long if-else chain with a switch expression or separate helper map. One action per line is mostly respected, and reading flow is natural: validate input, handle primitives in logical order, else return null. Minor points: the Javadoc explains behavior well, and comments note JLS intent. The only slightly verbose part is the repeated cast syntax, but this is necessary for generic return type. Overall, very maintainable and clear.
Run 3
The code is well-structured with clear intent: a utility class providing default values for Java types. The class is properly encapsulated with a private constructor, constants, and a single public method. Nesting is shallow—only two levels deep within the primitive type checks. The chain of `else if` statements is flat and readable, though somewhat repetitive. Each action is on its own line, and the reading flow is natural. The method is concise but could be improved by using a switch or map to reduce repetitive `else if` blocks. The Javadoc is helpful, and the annotations and imports are standard. Overall, the code is highly readable with minor opportunities for simplification.
Run 1
Code Structure: Well organized, with constants, a private constructor, and one focused public method. Nesting: Only two levels deep; the outer primitive check adds slight indentation but remains easy to follow. Clarity of intent: Descriptive names and precise documentation clearly explain default values, including null for reference types and void. Code length: Concise overall, though the repetitive type-check chain adds some length. Action granularity: Each check and return performs a single clear action, with no crowded statements. Reading flow: The method proceeds naturally from null validation to primitive-type handling and a final null fallback. Consistent formatting and explicit branches make behavior straightforward to inspect.
Run 2
Code Structure: A focused utility class with logically organized constants and a single public method. Nesting: Shallow overall, although the primitive check adds an extra level around the conditional chain. Clarity of intent: Descriptive names and precise documentation clearly explain default values, including null for reference types and void. Code length: Appropriately concise; the repetitive branches are straightforward rather than unnecessarily verbose. Action granularity: Each check and return performs one clear action, without compound statements. Reading flow: Validation, primitive dispatch, and the null fallback follow a natural sequence. Minor readability costs come from repeated generic casts, the long else-if chain, and tightly spaced package/import declarations.
Run 3
Code Structure: A well-organized utility class with constants and a single focused method. Nesting: Only two levels, though an early return for non-primitive types could flatten the method. Clarity of intent: Descriptive names and precise documentation clearly explain default values, including null for reference types and void. Code length: Appropriately concise; the repetitive conditional chain is straightforward and justified by explicit type handling. Action granularity: Each statement performs one clear action, with separate validation, comparisons, and returns. Reading flow: The method proceeds naturally from input validation to primitive-type dispatch and a null fallback. Minor readability costs come from unchecked generic casts and the slight inconsistency between cached floating-point defaults and directly constructed wrapper values.