Sample

JetBrains/b17

Human rating uses the original dataset scale.

DatasetJetBrains
Human0.94
Lines21

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
32.2Δ 57.2
Scalabrino0.5070–1; higher is more readable
32.2Δ 57.2
Dorn0.1880–1; higher is more readable
13.6Δ 75.8
Mi0.1420–1; higher is more readable
10.2Δ 79.2
LLOC12Logical lines; fewer is more readable
56.8Δ 32.6
DeepSeek V4 Pro140–20; mean of three runs
35.2Δ 54.2
GPT-6.1 Sol15.670–20; mean of three runs
19.9Δ 69.5
BTTF0.470–1; higher is more readable
54.2Δ 35.2
Human0.940–1; original rating
89.4

Views

Source code

import java.math.BigDecimal; public class CatalanConstant { public static void main(String[] args) { BigDecimal sum = new BigDecimal(0); BigDecimal term; for (int i = 0; i < 1000; i++) { int power = 2 * i + 1; if (i % 2 == 0) { term = BigDecimal.ONE.divide(new BigDecimal(power), 1000, BigDecimal.ROUND_HALF_UP); sum = sum.add(term); } else { term = BigDecimal.ONE.divide(new BigDecimal(power), 1000, BigDecimal.ROUND_HALF_UP); sum = sum.subtract(term); } } System.out.println("Catalan's Constant: " + sum); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(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.818.359−27.006
Source linesThe number of non-empty source lines.21+8.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.163−6.244

Intercept 8.87 + feature contributions = -15.98 (log-odds).
Score = sigmoid(-15.98) = 0.

Score0.507

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
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.81−0.732
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.21+0.293
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.19.914−0.131
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.106−0.089
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.21−0.061
Indentation frequencyHow rapidly indentation changes from line to line.21−0.011

Intercept 0.07 + feature contributions = -1.465 (log-odds).
Score = sigmoid(-1.465) = 0.188.

Score0.142
Score12
Run 1

The code is reasonably structured but has several readability issues. The main logic for computing Catalan's constant is straightforward, but the alternating sign handling adds unnecessary duplication: the term calculation appears in both branches of the if/else. Magic numbers like 1000 appear twice (loop bound and scale), and the intent behind the loop is not immediately clear. Variable naming is adequate but could be more descriptive (e.g., `scale`, `terms`). The structure is flat, which is good, but the code would benefit from extracting the term calculation and sign logic to reduce redundancy and improve clarity. Overall, it is understandable but not as clean or expressive as it could be.

Run 2

The code has a clear overall purpose and follows a simple, flat structure with no deep nesting. The loop logic is straightforward, and variable names like 'sum' and 'term' are generally clear. However, the code could be more concise: the term computation is duplicated in both branches of the if-else, which makes the logic slightly redundant and less clear. The condition `i % 2 == 0` to determine sign works, but the relationship between sign and the alternating series is implicit. Action granularity is reasonable; each key calculation is on its own line. The reading flow is natural, moving from initialization to looping to output. Overall, readability is good but would improve by extracting the term computation and using a clearer sign-handling approach.

Run 3

The code is generally clear and concise. It has a logical structure with a simple loop and basic operations. Nesting is minimal (one level inside the loop). The intent — approximating Catalan's constant — is deducible from the class name and output. However, readability is weakened by repeated code in both branches of the if-else, which could be reduced to a single term computation with a sign variable. The magic numbers (1000 iterations, 1000 scale) lack named constants, making them ambiguous. Line length is moderate, action granularity is mostly one action per line, and the reading flow is natural. Overall, it's readable but could be improved by eliminating duplication and adding named constants.

Run 1

Code Structure: Clearly organized into initialization, calculation, and output, though term calculation is duplicated across branches. Nesting: Shallow loop and conditional nesting is easy to follow. Clarity of intent: Variable names convey accumulation, but 'power' actually denotes an odd denominator, and the series computes an approximation to pi/4 rather than Catalan's constant, making the class name and output misleading. Code length: Compact overall, with avoidable duplication. Action granularity: Each statement performs a distinct action; long division expressions remain understandable. Reading flow: Execution proceeds naturally from setup to iteration to printing, although unexplained literals such as 1000 and the misleading mathematical labeling reduce clarity.

Run 2

Code Structure: The class, main method, loop, and output are logically organized, although term calculation is duplicated across branches. Nesting: A single conditional inside a loop keeps nesting manageable. Clarity of intent: Variable names and alternating addition/subtraction are understandable, but the code sums reciprocal odd integers rather than their squares, contradicting the stated Catalan's constant purpose. The unexplained values of 1000 for iteration count and decimal scale also obscure intent. Code length: Short overall, but calculating the term once before the conditional would eliminate redundancy. Action granularity: Each statement performs one clear action. Reading flow: Initialization, accumulation, and printing follow a natural sequence, though the misleading label and duplicated expression interrupt comprehension.

Run 3

Code Structure: Imports, class, initialization, computation, and output are logically organized, though the division is duplicated across branches. Nesting: A single loop containing an if/else keeps nesting shallow and manageable. Clarity of intent: Names and output convey the intended computation, but 'power' misleadingly names an odd denominator, and the formula lacks the squared denominator required for Catalan's constant. Code length: Short overall; computing the shared term before the conditional would remove repetition. Action granularity: Each statement performs one clear action. Reading flow: The sequence from setup through accumulation to printing is natural, although duplicated arithmetic and unexplained iteration and precision values slightly impede understanding.