Sample
int-c82cfd97077b-I05
Rewrite eligible decimal integer literals in hexadecimal notation
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Scalabrino | 0.871 | 0–1; higher is more readable |
| Dorn | 0.498 | 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 | 0–20; mean of three runs |
| BTTF | 0.411 | 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. | 1826.449 | −60.273 |
| 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.913 | −7.369 |
Intercept 8.87 + feature contributions = -37.572 (log-odds).
Score = sigmoid(-37.572) = 0.
| Score | 0.871 |
|---|
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.008 |
Intercept 0.07 + feature contributions = -0.008 (log-odds).
Score = sigmoid(-0.008) = 0.498.
| Score | 0.584 |
|---|
| Score | 23 |
|---|
Run 1
The code is well-structured with clear intent, good documentation, and a logical flow. The method is concise and each primitive type maps to a single return statement, keeping action granularity simple. Nesting is shallow, with only a two-level if/else chain inside a single outer check. However, readability suffers from the repetitive if-else chain, which could be replaced by a Map or switch for clarity. The use of constants for float and double defaults is inconsistent with inline values for other primitives, which slightly disrupts reading flow. Overall, it is readable but could be improved with a more uniform approach.
Run 2
The code is well-structured and readable. It has a clear purpose with a concise Javadoc explaining behavior. The method follows a logical flow: validate input, check primitive types, return default values, and fall back to null. Nesting is shallow—only two levels at most. Each action is on its own line, and the if-else chain for primitives is easy to scan. The use of constants for Float and Double avoids repetitive object creation, showing intent. Slight deductions for the repetitive primitive comparisons and unchecked casts, which add noise, and the boolean literal suppression is somewhat awkward. Overall, it is concise, clear, and maintainable, with only minor readability friction from generics and primitive type handling.
Run 3
The code is highly readable. It has a clear, logical structure with a single public method and private constructor. Nesting is shallow (two levels maximum). The intent is unambiguous: return the JLS default value for primitive types or null otherwise. The Javadoc clearly explains this behavior. The method is concise but not overly compressed, using a straightforward if-else chain. Each primitive check is on its own line, maintaining one action per line. The reading flow is natural: null check, primitive check, then ordered type comparison, ending with a null return. Constants for float/double defaults are a minor but sensible optimization. Minor deductions could be made for slight repetition in the if-else chain, but overall this is nearly ideal readable code.
Run 1
Code Structure: A focused utility class with logically grouped constants and a single public method. Nesting: Only two levels, keeping the conditional chain easy to follow. Clarity of intent: Descriptive names and precise documentation clearly explain default values, including null behavior. Generic casts and hexadecimal zero literals add slight cognitive overhead. Code length: Appropriately concise, though the repetitive primitive-type checks make the method somewhat verbose. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: Validation, primitive checks, and the final null fallback form a natural progression. Minor formatting improvements, such as separating the package declaration from imports, could further improve readability.
Run 2
Code Structure: Well-organized utility class with constants and a single focused method. Nesting: Shallow overall, though the primitive check adds an avoidable level around the conditional chain. Clarity of intent: Descriptive names and Javadoc clearly explain defaults, including null for reference types and void; generic casts and hexadecimal zero literals add minor complexity. Code length: Concise, with repetitive branches justified by distinct primitive types. Action granularity: Each check and return occupies its own line, making behavior easy to scan. Reading flow: Validation, primitive dispatch, and the null fallback follow a natural sequence. Minor import-spacing and literal-consistency improvements could further enhance readability.
Run 3
Code Structure: A focused utility class with logically grouped constants and a single public method. Nesting: Only two conditional levels, though the long else-if chain could be flatter. Clarity of intent: Descriptive names and precise documentation clearly explain primitive defaults and null behavior. Code length: Appropriately concise; repetitive branches are straightforward and justified by distinct primitive types. Action granularity: Each statement performs one clear action, with validation separated from value selection. Reading flow: Sequential type checks and consistent formatting make the method easy to follow. Minor readability costs include unchecked generic casts, hexadecimal zero literals, and the unexplained distinction between cached floating-point defaults and inline boxed values.