Sample

JetBrains/b39

Human rating uses the original dataset scale.

DatasetJetBrains
Human1
Lines19

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
68.6Δ 30.1
Scalabrino0.5920–1; higher is more readable
43.2Δ 55.5
Dorn0.7020–1; higher is more readable
86.4Δ 12.3
Mi0.5560–1; higher is more readable
63.6Δ 35.2
LLOC14Logical lines; fewer is more readable
47.9Δ 50.8
DeepSeek V4 Pro17.670–20; mean of three runs
88.6Δ 10.2
GPT-6.1 Sol180–20; mean of three runs
77.5Δ 21.2
BTTF0.5750–1; higher is more readable
85.6Δ 13.1
Human10–1; original rating
98.7

Views

Source code

public class PrimeNumbers { public static void main(String[] args) { int count = 0; for (int i = 2; i <= 10000; i++) { boolean isPrime = true; for (int j = 2; j <= Math.sqrt(i); j++) { if (i % j == 0) { isPrime = false; break; } } if (isPrime) { System.out.println(i); count++; } } System.out.println("Total prime numbers: " + count); } }

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.587.763−19.396
Source linesThe number of non-empty source lines.19+7.6
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.3.337−5.005

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

Score0.592

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.1+1.001
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.64+0.954
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.17.862−0.16
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.108−0.111
Indentation frequencyHow rapidly indentation changes from line to line.19−0.08
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.19−0.015

Intercept 0.07 + feature contributions = 0.855 (log-odds).
Score = sigmoid(0.855) = 0.702.

Score0.556
Score14
Run 1

The code is highly readable. It uses a clear class name, a straightforward main method, and a logical structure for checking prime numbers. Nesting is shallow with only two loops and one conditional inside the inner loop, aided by a break statement to avoid unnecessary iterations. The intent is evident: iterate from 2 to 10000, test primality via trial division up to the square root, print primes, and count them. Length is concise and efficient due to the sqrt optimization. Action granularity is one statement per line, improving clarity. Reading flow is natural—initialization, loop, primality check, output, and final count summary. Minor improvements could include extracting the primality check into a method for modularity, but overall the code is well-structured and easy to follow.

Run 2

The code is highly readable. It has a simple, logical structure with a clear main method. Nesting is minimal, with only two nested loops and a single conditional. The intent of finding and counting prime numbers up to 10000 is immediately clear from the variable names (i, j, isPrime, count) and the overall flow. The code is concise and achieves the task without unnecessary complexity. Action granularity is good—each line performs a focused operation. The reading flow is natural, progressing from initialization to iteration, primality checking, and finally output. Minor improvements could include extracting the primality check into a separate method for reusability, but this would not significantly improve readability for such a small program. Overall, it is a clean example of straightforward Java code.

Run 3

The code is highly readable. It has a clear, logical structure: initialization, a straightforward loop, a primality test, and output. Nesting is minimal (only two levels deep) and the early break prevents unnecessary computation. The purpose is unambiguous: find and count prime numbers up to 10,000. The code is concise, avoiding extra methods or verbose class structure while remaining effective for its task. Each line performs a single action, with no compounded operations. Reading flow is natural, top to bottom, with variable names like 'isPrime' and 'count' clearly expressing intent. The only minor improvement would be extracting the primality test into a separate method for even greater clarity, but for its size and scope, the code is excellent.

Run 1

Code Structure: Logically organized into candidate iteration, primality checking, output, and counting. Nesting: Moderate nesting from two loops and conditionals, but each block is short and easy to follow. Clarity of intent: The class name, isPrime flag, and final output clearly communicate the purpose; i and j are conventional but less descriptive, and 10000 could be a named constant. Code length: Concise without unnecessary statements. Action granularity: Each statement performs one clear action, with standard loop-header syntax. Reading flow: Natural progression from initialization through testing to reporting, supported by consistent indentation.

Run 2

Code Structure: Logically organized into candidate iteration, primality testing, output, and counting; extracting the primality test into a helper could improve separation. Nesting: Moderate and justified, with two loops and a conditional inside the inner loop. Clarity of intent: The class name, isPrime flag, and final output clearly communicate the purpose, though i and j are generic and 10000 is an unexplained limit. Code length: Concise, with no unnecessary boilerplate or repetition. Action granularity: Statements generally perform one action per line; conventional loop headers remain easy to read. Reading flow: Natural top-to-bottom progression, consistent indentation, and an early break make the logic straightforward to follow.

Run 3

Code Structure: Logically organized into candidate iteration, primality testing, printing, and counting, though a separate primality method could improve separation. Nesting: Moderate and appropriate, with an inner loop and conditional adding some depth. Clarity of intent: The class name, isPrime flag, and output clearly communicate the purpose; i and j are conventional but less descriptive than candidate and divisor. Code length: Concise, with no unnecessary code. Action granularity: Each statement performs a single clear action, and formatting is consistent. Reading flow: Natural top-to-bottom progression, with an early break making the divisor test easy to follow. A named constant for 10000 would make the range more explicit.