Sample

JetBrains/e4

Human rating uses the original dataset scale.

DatasetJetBrains
Human0.72
Lines16

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett0.010–1; higher is more readable
87.3Δ 39.8
Scalabrino0.8150–1; higher is more readable
76.3Δ 28.8
Dorn0.6990–1; higher is more readable
85.6Δ 38.1
Mi0.6510–1; higher is more readable
87.3Δ 39.8
LLOC11Logical lines; fewer is more readable
63.6Δ 16.1
DeepSeek V4 Pro170–20; mean of three runs
69.9Δ 22.5
GPT-6.1 Sol180–20; mean of three runs
77.5Δ 30.1
BTTF0.4890–1; higher is more readable
62.7Δ 15.3
Human0.720–1; original rating
47.5

Views

Source code

public class NivenNumbers { public static void main(String[] args) { for(int i=1; i<=10000; i++){ int sum = 0; int num = i; while(num != 0){ int digit = num % 10; sum += digit; num /= 10; } if(i % sum == 0){ System.out.println(i); } } } }

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.449.259−14.826
Source linesThe number of non-empty source lines.16+6.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.3.352−5.028

Intercept 8.87 + feature contributions = -4.583 (log-odds).
Score = sigmoid(-4.583) = 0.01.

Score0.815

Feature contributions

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

Intercept 0.07 + feature contributions = 0.843 (log-odds).
Score = sigmoid(0.843) = 0.699.

Score0.651
Score11
Run 1

The code is highly readable. It is well-structured, with a clear separation between the loop control, digit-sum calculation, and condition checking. Nesting is minimal (a while loop inside a for loop), which is appropriate for the task. The intent of generating Niven numbers is evident from the class name and logic. The code is concise—no unnecessary methods or comments for such a simple task. Each action (modulo, addition, division) is on its own line, enhancing clarity. The reading flow is natural: iterate numbers, compute sum of digits, test divisibility, print. Minor improvement could be extracting the digit-sum logic into a named method for semantic clarity, but for this scale of problem, keeping it inline is perfectly fine.

Run 2

The code is well-structured and easy to follow. It has a clear single-purpose main method, flat nesting (only one loop and one conditional), and each statement is simple and intent-revealing. Variable names are meaningful (i, sum, num, digit) and the digit-summing logic is concise. The loop is straightforward and the output condition is obvious. Potential minor improvements include adding a comment explaining Niven numbers, checking for division by zero (not an issue here since i > 0), and perhaps extracting the digit-sum logic into a helper method for reusability. Overall, it is highly readable.

Run 3

The code is clear and logically structured. It initializes variables with a single purpose per line and uses straightforward loops to compute digit sums and check Niven numbers. Nesting is shallow, and intent is evident despite the lack of comments or explanatory naming. The main class and method are standard, aiding readability. However, the code could be improved by extracting the digit-sum logic into a named method, which would clarify intent further and reduce slight cognitive load. Overall, it is concise and readable, with minor room for abstraction.

Run 1

Code Structure: Logically organized into iteration, digit summation, and divisibility checking. Nesting: Moderate and appropriate; the while loop and if statement sit within a single for loop. Clarity of intent: The class name and arithmetic clearly convey finding Niven numbers, though more descriptive variable names and a named upper bound would help. Code length: Concise without unnecessary statements. Action granularity: Each body statement performs one clear action; the for-loop header conventionally combines initialization, condition, and increment. Reading flow: Natural progression from selecting a number to calculating its digit sum and printing matches. Consistent spacing around operators and braces would improve polish.

Run 2

Code Structure: Logically organized into iteration, digit summation, and divisibility checking. Nesting: Shallow and appropriate; the while loop and if statement are contained within a single for loop. Clarity of intent: The class name and straightforward arithmetic convey the purpose, though more descriptive names than i and num and a named upper-limit constant would help. Code length: Concise without unnecessary statements. Action granularity: Each body statement performs one clear action. Reading flow: Natural progression from initialization to digit processing to output. Minor weaknesses include inconsistent spacing around operators and braces, and no brief explanation of what defines a Niven number.

Run 3

Code Structure: Logically organized around iteration, digit-sum calculation, and divisibility testing. Nesting: Shallow and easy to follow, with a while loop and conditional inside the main for loop. Clarity of intent: The class name and straightforward arithmetic convey the purpose, though more descriptive variable names and a named upper bound would help. Code length: Concise without unnecessary statements. Action granularity: Each statement performs one clear action on its own line. Reading flow: Natural progression from initialization through calculation to output; consistent spacing around operators and braces would improve presentation.